各位大侠,请帮帮小弟!
我在VB中用mscomm控件同一块嵌入式Linux单片机通信。
我可以接收到从单片机返回的以下信息:
Use External PCI Clock
Processor: SL3316a3
PCI Enable
AHB Bus Clock:100MHz    Ratio:3/2
RAM: 0x00000000-0x04000000, 0x00049250-0x03fef000 available
FLASH: 0x70000000 - 0x70800000, 135 blocks of 0x00010000 bytes each.
==> enter ^C to abort booting within 3 seconds ......接着,我就要给单片机发送一个ctrl+C的命令。我试着发送MSComm1.output = 3 '3为Ctrl^c的ASCII码
可是,单片机并没有任何提示。请问,我应该如何给这个单片机发送ctrl+c命令呢?谢谢!!!如果命令发送成功,会有以下的提示符:
     Boot Menu
====================================================================
1: Start the Kernel Code
2: List Image
3: Delete Image
4: Create New Image
5: Set IP adderss
6: Setting MAC addressX:Upgrade Boot    Y:Upgrade Kernel=> Select:

解决方案 »

  1.   

    使用 byte() 发送 看看
      

  2.   

    dim a(0) as byte
    a(0)=3
    MSComm1.output =a
      

  3.   

    首先设置Comm1:
       If Comm1.PortOpen = False Then
          Comm1.PortOpen = True
          Comm1.InputMode = comInputModeBinary
       End If
       Form1.Comm1.CommPort= 2 
       Form1.Comm1.Settings=2400,n,8,1
    发送函数如下:
    Private Sub send_Click()
       Dim check_sumer, check_sum, check_response As Integer
       Dim i As Integer
       Dim bytebuf(1 To 1) As Byte
       Dim buf1$
       
       check_sum = 0
       '设置进度条,检查串口
       If Comm1.PortOpen = False Then
          MsgBox "请打开串口", vbOKOnly, ""
       Else
          Counter = Len(Trim(textS.Text))  '计算发送数据的长度
          ProgressBar1.Min = 0
          ProgressBar1.Max = 512
          ProgressBar1.Visible = True
          ProgressBar1.Value = ProgressBar1.Min
          
          '接收到的字节数
           'If check_sumer Mod 4 = 1 Or check_sumer Mod 4 = 2 Or check_sumer Mod 4 = 3 Then
             ' bytebuf(1) = Int(counter/ 4) + 1
            '  Else
            '  bytebuf(1) = Int(counter/ 4)
          bytebuf(1) = 128
          Comm1.Output = bytebuf
          
          '按照每次发送四个数据的批次发送
          For i = 1 To 512 Step 4
             If i <= Counter Then
                buf1 = Mid(textS.Text, i, 4)
                bytebuf(1) = Operate(buf1)
                
                If bytebuf(1) = 255 Then
                   Comm1.Output = bytebuf
                   Exit Sub
                Else
                   check_sum = check_sum + bytebuf(1)
                End If
                
                If check_sum > 25600 Then
                   check_sum = check_sum - 25600
                End If
             Else      '发送零,以清显存
                bytebuf(1) = 0
             End If
             
             Comm1.Output = bytebuf
             ProgressBar1.Value = i
          Next i
       
         '发送累加和
          Delay 100
          check_sum = check_sum Mod 256
          bytebuf(1) = check_sum
          Comm1.Output = bytebuf
          ProgressBar1.Visible = False
          send.Enabled = False
       
        '接收回应信息
          Delay 100
          buf1 = Comm1.Input
          If buf1 = "" Then
             check_response = 255
          Else
             check_response = AscB(buf1)
          End If
          If check_response = 88 Then
             MsgBox "通过校验,接收成功", vbOKOnly, "信息提示"
          ElseIf check_response = 255 Then
             MsgBox "接收失败,请检查接收端连路", vbOKOnly, "信息提示"
          ElseIf check_response = 78 Then
             MsgBox "校验失败,请重新发送", vbOKOnly, "信息提示"
          End If
       End If
    End Sub我就是做这个的,这个实验已做成功了,你根据上面的仔细检查一下就知道了
      

  4.   

    我上面写错了,上面是发送 ^zmscomm.output = Chr(3)这样就行了