Home > Software engineering >  How to use vb to monitor COM1 port data content
How to use vb to monitor COM1 port data content

Time:11-09

This is what I write content, text1 not receive anything, novice also please advice, thank you!
 Private Sub Form_Load () 
MSComm1.Com mPort=1 'your COM1 serial port is
MSComm1. An InputMode=comInputModeText
MSComm1. Settings="9600, n, 8, 1", "
MSComm1. RThreshold=6
MSComm1. EOFEnable=true
MSComm1. Handshaking=comNone
MSComm1. InBufferSize=1024
Text1. Text=""
End Sub

Private Sub MSComm1_OnComm ()
The Select Case MSComm1.Com mEvent 'receiving data
Case comEvReceive 'to deal with data
InString=MSComm1. Input
Text1. Text=InString + Text1. Text
End the Select
End Sub

CodePudding user response:

Form_Load no open ports, MSComm1 PortOpen=True

CodePudding user response:

Another software in use COM1, MSComm1. PortOpen=True this add will be displayed after a serial port has been opened, tip error, like to do the thinking direction

CodePudding user response:

On the same computer cannot be open at the same time the same serial port has two programs, you can use the serial port simulation software to simulate another serial port, and then simulate connecting two serial ports can communication.

CodePudding user response:

CBOM1, COM2...

CodePudding user response:

If MSComm1. PortOpen=false then
MSComm1. PortOpen=True
  • Related