String ls_data
String ls_temp []
String TTT []
Blob lp_buff
//using COM3 port,
MPort=3
ole_1.object.Com
Ole_1. Object. Settings="9600, N, 8, 1"//set rate for 9600, parity, 8 bits of data, and a stop bit.
//read the data of the buffer,
Ole_1. Object. InputLen=0
//open port
If ole_1. Object. PortOpen=false then
Ole_1. Object. PortOpen=True
End the if
//send command attention
TTT [1]=char (64)
TTT [2]=char (48)
TTT [3]=char (67)
TTT [4]=char (82)
TTT [5]=char (44)
TTT [6]=char (50)
TTT [7]=char (156)
TTT [8]=char (154)
TTT [9]=char (13)
TTT [10]=char (14)
TTT [11]=char (15)
//lp_buff={blob (" ~ h40 "), a blob (" ~ h30 "), a blob (" ~ h43 "), a blob (" ~ h52 "), a blob (" ~ h2C "), a blob (" ~ h32 "), a blob (" ~ h9C "), a blob (" ~ h9A "), a blob (" ~ h0D "), a blob (" ~ h0E "), a blob (" ~ h0F ")}
Lp_buff=blob (TTT) [1] + blob (TTT) [2] + blob (TTT) [3] + blob (TTT) [4] + blob (TTT) [5] + blob (TTT) [6] + blob (TTT) [7] + blob (TTT) [8] + blob (TTT [9]) + blob (TTT) [10] + blob (TTT) [11]
Ole_1. Object. The output=lp_buff
The Yield ()
Sleep (1)//delay 1) seconds,
//data from the Com port
Ls_data=https://bbs.csdn.net/topics/ole_1.object.Input
//close port,
Ole_1. Object. PortOpen=FALSE
//if ls_data & lt; & gt;" "Then
////send command attention
////ls_temp="40 30 43 52 2 c 30 BC D8 0 0 0 f e d"
//ole_1. Object. The Output=ls_temp
//
//sle_1. Text=ls_data
//
//END IF
//
CodePudding user response:
This seems to be very few people really use a success, or out, no one is provided with PBapi to be usableCodePudding user response:
Receive data should be written in the oncomm event of ole, receives the data will be automatically triggered, so you the output code behind noIf This.Object.com mevent=2 Then//a data
Ls_data=https://bbs.csdn.net/topics/ole_1.object.Input
Ls_tempstr=ls_data ls_tempstr +
Sle_1. Text=ls_tempstr
End the if
And don't have to close a serial port receives the data
Open the serial port code can be written in the window, such as the open event of
After you send the data to look in the debug oncomm event has no data out
Didn't come out no data to show you there hardware (could you send his wrong, so it is not send data out)
CodePudding user response:
Can send 0 x00, these characters you sure no problem, using mscomm controlCodePudding user response: