High speed Serial Port output

Hi,
 I am writing an application in which i need to output 3 bytes of data to the serial port 20 times a second. I tried to use the MSComm control but it seems to delay the output of the data (presumably because of buffering or something) and can not cope with the speed I require, so i get 'Out of stack space' errors. I am running my port and serial device at 9600baud so I would have thought this would have been fast enough as i should only require 480 baud (3 bytes * 8 bits per byte * 20 times a second = 480.) Is there any way to output the data faster without the delay/buffering using the MSComm control or any other alternative ways of serial port output? Sample code would be great too :)
Thanks,
Matt.
pyromattAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
There should be no problem running at that speed with the MSComm component

'Out of stack space' is usually caused by a recursive call gone out of control. I can't understand the connection with slow output.

Perhaps you should post your code
0
pyromattAuthor Commented:
Public Function SerOut(PortData As String)
 Do
  DoEvents 'Prevent 'Port already open' errors
 Loop Until frmMain.SerPort.PortOpen = False
 frmMain.SerPort.PortOpen = True
 frmMain.SerPort.Output = PortData
 frmMain.SerPort.PortOpen = False
End Function

PortData always contains 3 characters, and this fuction is used 20 times a second. The serial port however, only manages to output around 2 a second and so after a few seconds i get a stack space error.
0
GrahamSkanRetiredCommented:
Why don't you just leave the port open?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

pyromattAuthor Commented:
I thought you had to close the port to send the data? I always thought 'output' just buffers it and it isnt sent until you close it.
0
pyromattAuthor Commented:
Doh! Ive found the problem. I forgot to disable DTR and hence having to close the port everytime i need to send data (and hence the slowness)!
0
moduloCommented:
Closed, 200 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.