- Oct
- 6
- 0
The following code:
(The second run is with the USB cable to COM6 unplugged).
At this stage, there are no characters in the serial buffer of it to read.
The returned value (result) from @SERIALPORTREAD seems to be 1 in every case. Is this an 'OK' result? If so, where are the read characters stored?
If the returned characters are also returned, how can you tell the difference between a return of 1 meaning it ran OK, and 1 meaning that a single digit 'one' was in the serial buffer?
We are reading a device that we are expecting to return a single digit, 1 or 0.
This looks like a bug, but it might be a 'how to'.
set port=COM6
set h=%@SERIALPORTOPEN[%port]
echo Handle %h
set result=%@SERIALPORTREAD[%h,0]
echo Read "%result"
set result=%@SERIALPORTCLOSE[%h]
echo Closed port %port (Handle %h) with result "%result"
produces the output:set h=%@SERIALPORTOPEN[%port]
echo Handle %h
set result=%@SERIALPORTREAD[%h,0]
echo Read "%result"
set result=%@SERIALPORTCLOSE[%h]
echo Closed port %port (Handle %h) with result "%result"
(The second run is with the USB cable to COM6 unplugged).
At this stage, there are no characters in the serial buffer of it to read.
The returned value (result) from @SERIALPORTREAD seems to be 1 in every case. Is this an 'OK' result? If so, where are the read characters stored?
If the returned characters are also returned, how can you tell the difference between a return of 1 meaning it ran OK, and 1 meaning that a single digit 'one' was in the serial buffer?
We are reading a device that we are expecting to return a single digit, 1 or 0.
This looks like a bug, but it might be a 'how to'.