Link to home
Start Free TrialLog in
Avatar of realpayne
realpayne

asked on

Xon/xoff flow control with MSComm

I've been trying to reliably send ASCII files to a NC machine tool that has a 132 character input buffer. When about 120 characters have been sent the machine sends an xoff( ASCII 19). When some of the characters have been transferred from the buffer to the main memory a xon (ASCII 17) character is sent to request more characters. I have tried both the OnComEvent method and even polling the serial port and have not been consistantly able to trap the flow control characters. My instantaneous rate is 9600 Baud. I seem to recall a reference that stated that the inner workings of MSComm results in the port being polled 18 1/2 times per second even in the OnComEvent mode. At 9600 Baud that is a deadband of about 52 characters. If that is true then it seems that xon/xoff will periodically fail. My kludged solution is to send one character and then Sleep for 3 milliseconds. That seems to keep up with the bleedout rate of the buffer.
ASKER CERTIFIED SOLUTION
Avatar of Lewy
Lewy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial