call TempNow
label5.caption=TempNow
You are setting the caption to a function. Why? What is that supposed to accomplish?
For i = 1 To 5
Sleep 10
str = MSComm1.Input
' I use "Tmp and "@" instead of "<" and ">"
If InStr(str, "Tmp") > 0 And InStr(str, "@") > 0 Then
GoTo J1
End If
Next i
Try 5 times to read all data that has arrived so far. Hope like hell that one of those 5 times will contain a whole packet.
It does NOT work that way. Once you have read the data that has arrived so far, that data gets thrown away if it is not a complete packet. It is likely that it won't ever be.
You need to read each partial packet, and APPEND it to some other string. Then, test that other string to see if it contains a complete packet. Do NOT erase the other string. Ever. Just remove the complete packet from the front, and append data to the end.