Click to See Complete Forum and Search --> : Continually read serial port
Jeffrey Kolwicz
Jan 10th, 2001, 01:35 PM
How can I continually read the serial port via MSComm? The device I'm reading sends a message every second. I'd like to accept the data when it is being sent without using a timer. Can this be done?
Bill Crawley
Jan 24th, 2001, 02:59 AM
Just coding in the oncomm event should do it. Failing that it may be worth looking at the SAX Comm Object control that has a lot more events than the standard com control. I must admit I use this instead of the standard control and it's superb.
Chris
Jan 25th, 2001, 12:11 PM
Juz loop till the MSComm1.InBufferCount = 0
Option Explicit
Dim rdStr As String
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive
rdStr = MSComm1.Input
Do While MSComm1.InBufferCount <> 0
rdStr = rdStr & MSComm1.Input
DoEvents
Loop
Case Else
End Select
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.