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? \n \n \'configure the com port settings \n \' SerialCom.CommPort = 2 \n SerialCom.Settings = "9600,N,8,1" \n SerialCom.RThreshold = 0 \n SerialCom.RTSEnable = True \n \n \'open the com port \n On Error Resume Next \n SerialCom.PortOpen = True \n \n \'check if port available \n If Err Then \n MsgBox "COM" & SerialCom.CommPort & "is not available" \n Exit Sub \n End If \nSelect Case SerialCom.CommEvent \n Case comEvReceive \n Do While SerialCom.InBufferCount \n inputText.Text = inputText.Text & SerialCom.Input \n Loop \n End Select \n SerialCom.PortOpen = False \n \n \n \n
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
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET. subscribe