I am converting an older program written in PB3.2 to PB3.5 and
PBVision. I am communicating with a Jaguar Scale Unit via Serial
Port COM1. To describe my process, I send a "P" to the scales and
it send back a String containing the current weight. The function
is needed to make sure that a response is received from the scales.
This function works fine under PB3.2 but just appears to stall out
when compiled under PB3.5 and PBVision. The program hangs (or never
leaves) the DO:LOOP routine. This code did work until updated. I
removed the LOC code and utilized just a .15 second delay and then
read the port and thats fine. But I still need to have some way to
know when to resend the "P" so the main program does not hang. Is
LOC the problem here?
FUNCTION ReadWt 'send a 'p' to the scale and it will send back
ST=TIMER
PRINT #3,"P";
DO
IF LOC(3) > 5 THEN EXIT DO ' Exit Do when something comes in from port
IF TIMER > ST+0.5 THEN
PRINT #3, "P"; ' IF TIMER TIMES OUT THEN SEND ANOTHER P
ST = TIMER
ITERATE
END IF
LOOP
INPUT #3,X$
ReadWt = VAL(MID$(X$,9,7)) - zeromv
END FUNCTION
------------------
Michael Burgett
Comment