baddy
08-31-2000, 08:52 PM
I am having some problem with receiving data for a serial port. There is either no data displayed or strange ascii will appear. Can anyone tell me what changes I should make to this code?
'configure the com port settings
' SerialCom.CommPort = 2
SerialCom.Settings = "9600,N,8,1"
SerialCom.RThreshold = 0
SerialCom.RTSEnable = True
'open the com port
On Error Resume Next
SerialCom.PortOpen = True
'check if port available
If Err Then
MsgBox "COM" & SerialCom.CommPort & "is not available"
Exit Sub
End If
Select Case SerialCom.CommEvent
Case comEvReceive
Do While SerialCom.InBufferCount
inputText.Text = inputText.Text & SerialCom.Input
Loop
End Select
SerialCom.PortOpen = False
'configure the com port settings
' SerialCom.CommPort = 2
SerialCom.Settings = "9600,N,8,1"
SerialCom.RThreshold = 0
SerialCom.RTSEnable = True
'open the com port
On Error Resume Next
SerialCom.PortOpen = True
'check if port available
If Err Then
MsgBox "COM" & SerialCom.CommPort & "is not available"
Exit Sub
End If
Select Case SerialCom.CommEvent
Case comEvReceive
Do While SerialCom.InBufferCount
inputText.Text = inputText.Text & SerialCom.Input
Loop
End Select
SerialCom.PortOpen = False