The following program is basic communication between PC and MCU by using MsComm. I send a "hex 35" to MCU, then MCU will return 22 bytes hex one time . I have already tested my MCU(8031) programe by LookRS232(serial com debuger). It's OK.
The question is the following program has sent "hex 35" successfully, but it can not display all 22 bytes in the Text1.Text . Only the first byte display in that. How can I do? Thank you in advance!
Private Sub Command2_Click()
' Buffer to hold input string
Dim Instring As String
Dim Buffer1 As String
' Use COM1.
MSComm1.CommPort = 1
' 600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "600,N,8,1"
' Tell the control to read entire buffer when Input
' is used.
MSComm1.InBufferCount = 0 ' Clear Input Buffer
MSComm1.InputLen = 0
MSComm1.InBufferSize = 1024
' Open the port.
MSComm1.PortOpen = True
' Send the attention command to the modem.
MSComm1.Output = Chr$(&H35) ' Ensure that
' the modem responds with "OK".
' Wait for data to come back to the serial port.
Do While MSComm1.InBufferCount <> 0
Buffer1 = Buffer1 + MSComm1.Input
Text1.Text = Text1.Text & (Hex(Asc(Buffer1)))
' Read the "OK" response data in the serial port.
' Close the serial port.
MSComm1.PortOpen = False