Re: RS232 flowcontrol
- From: "Dick Grier" <dick_grierNOSPAM@.msn.com>
- Date: Tue, 17 Jun 2008 10:30:16 -0600
Hi,
What you are seeing is two-fold.
First, the USB driiver software (virtual serial port) UART probably
implements a 96-byte (or possible deeper) transmit FIFO. This FIFO is
emptied, even if CTS is lowered. There isn't anything that you can do in
your application code if this is, in fact, the case -- except to work around
it yourself (see below).
Second, the FIFO in your PC UART is only 16-bytes in depth, so it sounds
like the receiving hardware can handle 16-bytes, but not the larger number.
So, what's the work-around? The obvious. Leave CTS/RTS flow control in
place, then... Write a routine that breaks transmit data into small chunks,
of less than 16-bytes. Check the status of CTS in your transmit routine.
If CTSHolding = True, then send 16-bytes. Add a small delay between each
16-byte "chunk" to allow CTS to propogate from hardware to your software.
If CTSHolding = False, then stay in a delay loop until it goes back to True.
Continue until all data have been sent. I'd start with about a 1 mS or so
delay between each "chunk," but a much larger delay inside the loop (perhaps
50 mS). Keep decreasing the large delay until you encounter a problem, then
bump it back up some, until it is reliable.
--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
.
- Prev by Date: Re: Icon in Windows
- Next by Date: TLB or not TLB
- Previous by thread: Re: GetOpenFileName & hook proc api calls
- Next by thread: Re: RS232 flowcontrol
- Index(es):