maggots
Member level 4
hey guys...thx for your time ...
I have a project using another hardware device.The device communication with computer using serial port.
first,If i try to connect it with hyperterminal program from windows ... it doesn't have problem.(my hardware ok..)
but if try to connect to vb program the character that i show with label1.caption always '?'
but if try using my vb program and short the rx dan tx pin(its looping itself),
the character i send and receive and then display in label1.caption is right...
Character 'A' and 'B' is displayed...
here is my code...
Code:
thx for helping me,guys...
sorry if my english is bad...
I have a project using another hardware device.The device communication with computer using serial port.
first,If i try to connect it with hyperterminal program from windows ... it doesn't have problem.(my hardware ok..)
but if try to connect to vb program the character that i show with label1.caption always '?'
but if try using my vb program and short the rx dan tx pin(its looping itself),
the character i send and receive and then display in label1.caption is right...
Character 'A' and 'B' is displayed...
here is my code...
Code:
Code:
Private Sub cmdM_Click()
UartCom.InBufferCount = 0
UartCom.Output = Chr(65) 'display A
UartCom.InputLen = 1
S = ""
On Error Resume Next
Do
dummy = DoEvents()
'If there is data in the buffer, then read it.
If UartCom.InBufferCount Then
S = S + UartCom.Input
Exit Do
End If
Loop Label1.Caption = S
End Sub
Private Sub cmdM_Click()
UartCom.InBufferCount = 0
UartCom.Output = Chr(66) 'display B
UartCom.InputLen = 1
S = ""
On Error Resume Next
Do
dummy = DoEvents()
'If there is data in the buffer, then read it.
If UartCom.InBufferCount Then
S = S + UartCom.Input
Exit Do
End If
Loop Label1.Caption = S
End Sub
Private Sub Form_Load()
'setting serial
UartCom.CommPort = 1
UartCom.Settings = "9600" & "M" & ",8,1"
UartCom.PortOpen = True
End Sub
thx for helping me,guys...
sorry if my english is bad...