COM Port Handshaking
Peter Reid
preid at reidit.co.uk
Sat Apr 13 03:53:01 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.
The cable is fully wired (8 lines + earthing) to support hardware
handshaking. Unfortunately the equipment is rather old, the manual
rather thin on detail and no longer supported by the current
manufacturer. So I can't get any more detail from the original
suppliers. The comms settings on the equipment's physical control
panel doesn't mention xon/xoff or any form of handshaking, just baud,
word length (7/8 bit), stop bits & parity, line ending (CR/CR+LF),
duplex (half/full).
>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.
I've been experimenting with these, but find that sometimes only part
of the command is received by the equipment. All commands are 3
character codes with optional numeric parameters. All commands are in
7-bit ASCII.
>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.
What I'm not sure of is the correct handshaking protocol and how I do
this in Rev. How do I use CTS, DTR etc. assuming that these lines are
being used (which the equipment manual implies that they are). Are
there any messages associated with the COM ports that I can trigger
on or wait on?
>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.
Yep, happy with this.
>Before you get too far into handshaking, you might want to look at
>your scripts with an eye on timing.
Yep, happy with this issue as well
>Dar Scott
Thanks Dar for the feedback
--
Peter Reid
Reid-IT Limited, Loughborough, Leics., UK
Tel: +44 (0)1509 268843 Fax: +44 (0)870 052 7576
E-mail: preid at reidit.co.uk
Web: http://www.reidit.co.uk
More information about the use-livecode
mailing list