globalvision
Posts: 12
Joined: Wed Sep 21, 2005 6:55 pm
Location: Slovenia

Read Serial Port Buffer in one go

Mon Sep 04, 2006 4:40 pm

This is the code which reads one character and waits 5 seconds:

Dim Res As String = COM.Read(1, 5000)

What do we have to do to read entire input buffer in one go and no waiting? We dont want to use events.

Regards
[:I]

User avatar
johan
GpsGate
Posts: 14913
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Read Serial Port Buffer in one go

Mon Sep 04, 2006 4:51 pm

Port.BufferSize will return the number of bytes in the input buffer. You can use this argument in a Port.Read() to read all data.

If you can make a loop to read data with a short timeout, e.g. 1 milisec, until Port.Read() returns Null.

Regards,
Johan

Franson Support

Return to “SerialTools”