| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. Accessing the COM port #13634 Posted by: DougA 2013-04-18 01:55:39 | I have a PicAXE micro attached to my COM2 port. The PicAXE programing software is able to send and receive to the micro.
I'd like to use a REXX program to do the receive instead.
In the test program below, the Stream Open is returning "READY:" The Status command is returning "READY" However, the chars(port) command returns 0, so it's not finding any data
There's noting in here however, to set the RS-232 parms, like baud, parity, etc Back in DOS days, I believe, there was a 'mode' command. The PicAXE programming software is showing me 9600,n,8,1 How does one go about setting this in the REXX program ?
This is a real RS-232 port, not USB converted.
/* make a terminal emulator to capture data from the PicAXE */
port = 'COM2'
IF STREAM(port, 'C', 'OPEN READ') == 'READY:' THEN DO CAll ReadTerminal STREAM(port, 'C', 'CLOSE') end ELSE SAY STREAM(port, 'D')
Exit
ReadTerminal: Say "Status:" Stream(port, 'S') Do 300 If CHARS(PORT) > 0 then do rec = charin(port,,30) err = stream(port,'D') Say length(rec)">"rec"<" err end else say 'no data' end ReturnDoug | Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|