nguyen binh
02-08-2010, 02:24 AM
Em có viết chương trình giao tiếp cổng com. Khi test thử gửi tín hiệu xuống để tắt mở led thì được nhưng không thấy tín hiệu gửi về máy tính. các huynh có cách nào giúp em phát hiện tín hiệu gửi về bằng cách đo đạc được không?
đoạn code em viết cho píc6f877a
while true
if (UART1_Data_Ready() <> 0) then
receive = UART1_Read()
uart1_write(receive)
rc5_bit = receive
delay_ms(500)
end if
wend
còn đây là code visual basic
Private Sub Command1_Click()
MSComm1.Output = "1"
End Sub
Private Sub Command2_Click()
MSComm1.Output = "0"
End Sub
Private Sub Form_Load()
Dim inputstring As Byte
MSComm1.CommPort = 4
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
Text1.Text = MSComm1.Input
End If
End Sub
đoạn code em viết cho píc6f877a
while true
if (UART1_Data_Ready() <> 0) then
receive = UART1_Read()
uart1_write(receive)
rc5_bit = receive
delay_ms(500)
end if
wend
còn đây là code visual basic
Private Sub Command1_Click()
MSComm1.Output = "1"
End Sub
Private Sub Command2_Click()
MSComm1.Output = "0"
End Sub
Private Sub Form_Load()
Dim inputstring As Byte
MSComm1.CommPort = 4
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
Text1.Text = MSComm1.Input
End If
End Sub