• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

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.
1 Solution
Try setting the Handshaking property to comXonXoff and let the control do the hand shaking.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now