我的串口MODE上电后就会向串口发送很多的字符:
System started!
Press 's' key continuously to enter configure program.
GPRS-1000T Configure Program:
Use the extended AT commands configure the 
arguments needed 现在我想在出现“Press 's' key continuously to enter configure program.” 这一句后就向设备发送“S”,我应该怎么办啊?

解决方案 »

  1.   

    Private Sub MSComm1_OnComm()
    Dim ST As String
    ST = MSComm1.Input
    Select Case MSComm1.CommEvent
        Case comEvReceive
             If InStr(ST, "Press 's'") <> 0 Then
                  MSComm1.Output = "s" & vbcrlf
             End If 
    end select
    end sub
      

  2.   

    http://www.programsalon.com/dl.asp?id=18262
      

  3.   

    http://www.haiyun.net/computer/list.asp?id=27
      

  4.   

    http://www.weiw.com/article/list.asp?id=388
      

  5.   

    http://www.icbaba.com/bbs/read.asp?id=29
      

  6.   

    可是我接收的都是空的啊,就是ST = MSComm1.Input
    ,我断点调试了一下,ST是空的啊!是不是由于我设置了OnComm事件?我RThreshold设置为1。
      

  7.   

    Private Sub MSComm1_OnComm()
    Dim ST As String
    Select Case MSComm1.CommEvent
        Case comEvReceive
             If InStr(ST, "Press 's'") <> 0 Then
                  MSComm1.Output = "s" & vbcrlf
             End If 
    end select
    end sub
      

  8.   

    午夜逛街的程序段有点问题, 应该改为:Private Sub MSComm1_OnComm()
    Dim ST As String
    Select Case MSComm1.CommEvent
        Case comEvReceive
             ST = MSComm1.Input
             If InStr(ST, "Press 's'") <> 0 Then
                  MSComm1.Output = "s" & vbcrlf
             End If 
    end select
    end sub
      

  9.   

    这样试试:
    定义全局变量
    Dim ST as String在load()中初始化
    ST=""原程序改为:
    Private Sub MSComm1_OnComm()
    Dim ST As String
    Select Case MSComm1.CommEvent
        Case comEvReceive
             ST =ST + MSComm1.Input
             If InStr(ST, "'s'") <> 0 Then
                  MSComm1.Output = "s" & vbcrlf
                  ST=""                  '(或者处理后再清空)
             End If 
    end select
    end sub