高分!!求救evb串口问题
各位急救:
同样的代码,在vb下没问题,但在EVB上就串口没相应。。。。
郑没回事????现将代码如下列出:
如有已作好的例子,请发给我一份。。。。万分感激
给高分
*************************
Option Explicit
Private Sub comm1_OnComm()
Dim combuf As String
Select Case Comm1.CommEvent
Case comEvReceive
'读取串口数据
combuf = combuf + Comm1.Input
Label1.Caption = "正在接收数据。。。。。"
Label1.Caption = combuf
'Modem已正常拨号,返回OK
Case comEvSend
End Select
End Sub
Private Sub Command1_Click()
Dim Number As String
Timer1.Interval = 1000
Timer1.Enabled = True
'拨电话号码
Number = "GETCOMM00!"
'清除接收缓冲区
Comm1.InBufferCount = 0
Comm1.Output = Number
Label1.Caption = "正在发送 -" + Number
End Sub
Private Sub Form_Load()
Comm1.CommPort = 1
Comm1.PortOpen = True
'设置可用的第一个串口
End Sub
Private Sub Timer1_Timer()
Dim combuf As String
combuf = combuf + Comm1.Input
Label1.Caption = "正在接收数据。。。。。"
Label1.Caption = combuf
Timer1.Enabled = False
End Sub
****************************
问题点数:0、回复次数:3Top
1 楼feiyan123123(阿飞)回复于 2005-04-04 15:15:53 得分 0
怎莫没人回贴呀???有例子发到我的邮箱,一样给分:feiyan123123@sohu.comTop
2 楼jiess(刘伟庭)回复于 2005-04-04 21:42:25 得分 0
不知楼主的EVB程式,是运行在模拟器中还是实际的设备.
最好在实际的设备中调试.
下面给一段示列代码:
Option Explicit
Dim strTemp As String
Private Sub cmdClose_Click()
If Comm1.PortOpen = True Then
Comm1.PortOpen = False
End If
End Sub
Private Sub cmdCommand_Click()
Comm1.Output = txtCommand.Text + Chr(13)
End Sub
Private Sub Comm1_OnComm()
Select Case Comm1.CommEvent
Case comEvReceive
strTemp = strTemp + Trim(Comm1.Input)
End Select
txtStatus.Text = txtStatus.Text + strTemp
End Sub
Private Sub Form_Load()
Comm1.CommPort = 1
Comm1.Settings = "9600,N,8,1"
Comm1.PortOpen = True
End Sub
Private Sub Form_OKClick()
If Comm1.PortOpen = True Then
Comm1.PortOpen = False
End If
App.End
End Sub
Top
3 楼feiyan123123(阿飞)回复于 2005-04-05 08:56:19 得分 0
我已经按你代码做拉,还是不行!!!我用的是模拟器!。。。你这个在模拟器你跑吗???
我正急着呢。。。。能给我试一下吗???顺便帮我解释一下Top




