COM Port Handshaking
Dar Scott
dsc at swcp.com
Fri Apr 12 10:01:00 EDT 2002
On Friday, April 12, 2002, at 06:32 AM, Peter Reid wrote:
> Can someone tell how to set up a PC COM port for hardware or
> software handshaking. Any other advice or examples of COM port
> working would be appreciated.
>
The device on the other end needs to understand the handshake.
Check your manual for that. Also, if you use hardware handshaking,
then the cable needs to be wired for it. The recommended cable for
the equipment might also provide a clue as to handshaking.
Use the serialControlString property to set up handshaking before
opening the COM port.
For software handshaking, include "xon=on" in your string.
For hardware handshaking, use one of the hardware control
substrings. I have not used these yet, but the doc says it is the
same as the the string for the mode command in Windows. The
documentation for that is slightly different in important ways. I
suspect you want "rts=hs", but I'm just guessing. I'd be pleased
to learn what you find out.
Some equipment cannot talk and walk at the same time. For some you
should not send a command until you have the complete response from
the previous command. Also, some equipment will send unsolicited
information and that might confuse your code. In this case set up
response handling to be always on and independent of commands.
ASCII data? If the response might includes nulls, remove or change
those before putting the response into a field. Also, you might
need to do some end-of-line transformations.
Before you get too far into handshaking, you might want to look at
your scripts with an eye on timing.
Dar Scott
More information about the use-livecode
mailing list