Internet PLC Forum
General => Technical support => Topic started by: garysdickinson on July 08, 2015, 11:43:14 AM
-
Simulator problem with INCOMM(2)
The handling of INCOMM() in the simulator is wrong. INCOMM() is supposed to return a value of -1 if there are no characters in the receive buffer. However when running the simulator INCOMM() returns a value of 0.
This behavior converts the following code to an endless loop rather than a flush of the receiver buffer:
while (INCOMM(2) <> -1)
' flush receive buffer for this serial port
endwhile
[/font][/color]
I supposed I could add a loop counter to break the loop after 256 iterations to work around the simulator...
Sorry,
Gary D
-
Thank you for the report. The communication part of i-TRiLOGI is not very well simulated on the simulator and it is probably better to just implement it on the actual hardware for testing.
If you want to simulate all the processing of incoming characters you can use a function to fill up the variables that you would have received from incomm or INPUT$ and then you can better simulate and test the processing (e.g. substring extraction and conversion to integers etc).