In PB, How to read input with COMM Line with no LF?

30 views
Skip to first unread message

Charles Emrick

unread,
Dec 14, 2012, 1:08:57 PM12/14/12
to velmex-...@googlegroups.com
I am using PB10 to communicate with a VXM that only returns a CR with certain commands. After a R (run) command is given, the controller returns a "^" with an optional CR upon completion of the task.

I prefer not to use "open loop" commands without knowing equipment status. Is there a method to "mask" the COMM Line requirement for both CR/LF or do I need to use a different approach? I thought about using the COMM function with RXQUE but didn't know how to check for "^" and then clear the RXQUE as it is read only.

Any suggestions would be appreciated.

Thank You

Cliff

unread,
Dec 14, 2012, 6:13:52 PM12/14/12
to
Hi Charles,
From the PowerBasic documentation "COMM LINE [INPUT] [#] hComm, string_var"
"
Read a delimited line of data from the receive buffer, where a "line" is defined as a stream of data that is terminated by a CR/LF"


Since the VXM does not send $CRLF then you should be using "COMM RECV [#] hComm, count&, string_var"
"
Retrieve the count& number of bytes from the receive buffer, placing the results in string_var. Program execution will halt until count& bytes are available, so it is wise to check how many bytes are available before making a COMM RECV request"

For Example:
Qty& = COMM(#hComm, RXQUE)
COMM RECV #hComm, Qty&, a$



Reply all
Reply to author
Forward
0 new messages