>MSComm :
>
> - slow
>
> We tried to use the MSComm control for modem communication. Apart from the
> already documented bugs sending of data was too slow to be usable. The
> delays actually occured when sending the data, not in the EVB program.
Yep, absolutely correct, BUT, you can speed it up - If you are willing
to give up the processor.
The problem appears to be that the OS has poor interrupt
processing for VB COMM transmit (no failures seen on input - interrupt
appears to work fine there - I have never gotten an overrun).
You can speed up the output port by releasing time
to the OS (Sleep API call).
By loading the processor down with a tight Do loop, I was able to slow
the output down
from 9600 baud (~ 1000 char / Sec) to as little as 100 char / Sec. I
suspect I could
have even gotten it slower, but I proved the point and stopped there.
What I came up
with as a fix is:
9600 8 N 1 is ~ 1000 char / Sec or ~ 1 Millisecond per char
1. Send large Output data string (buffered many lines to get a large
string of characters > 2K)
2. I called Sleep with the number of milliseconds = the number of
characters sent
3. After the Sleep returns, request the number of char remaining in the
output buffer
4..Call Sleep once more with the number of milliseconds = number of
characters remaining
I got the delivered baud rate up to > 850 char / Sec on code that
had only been delivering 250-300 char / sec at best. My code was then
usable and met requirements.
Interesting note, if your code is GUI based and the Output
is caused by an event from the GUI, you may not see this problem.
For Example, if the serial output data is sent and the event
finishes, the data runs full speed - or should I say almost full speed
(assuming NO other Processing activity by the current or any other
program
- to "slow down" the port).
I only needed 9600 baud, so your mileage may vary, but I suspect that
you will have notable success at other baud rates.
If you have the luxury of buffering up the data to
send and can Sleep off your Serial transfer, the above works. Too bad
that you need to use the PPC processor as a dedicated UART driver.
Does anyone know the year that interrupts were invented for Serial
ports?
- What year are we developing in?
Ahh the nostalgia. Anyone for assembly code programming?
rick