Home > database >  PB programming read electronic said (RS232 COM serial port)
PB programming read electronic said (RS232 COM serial port)

Time:10-09

PB programming read electronic says (RS232 COM serial port)?

Below is through the BUTTON CLICKED event, can read, how to read the data?

String ls_text, ls_flag
Dec ldec_wt

Ls_text=serial_port1. Read (2000)
If isnull (ls_text) or ls_text='or len (trim (ls_text))=0 then
Return
End the if
Ls_text=trim (ls_text)
If pos (ls_text, 'GGU) & gt; 0 then
Ls_text=trim (mid (ls_text, 1, pos (ls_text, 'GGU) - 1))
End the if
If pos (ls_text, 'GGS) & gt; 0 then
Ls_text=trim (mid (ls_text, 1, pos (ls_text, 'GGS) - 1))
End the if
If pos (ls_text, '+') & gt; 0 then
Ls_text=trim (mid (ls_text, pos (ls_text, '+') + 1))
End the if
If pos (ls_text, '+') & gt; 0 then
Ls_text=trim (mid (ls_text, 2))
End the if
If isnumber (mid (ls_text, 1, 7)) then
Ldec_wt=dec (mid (ls_text, 1, 7))
//to empty
Serial_port1. Write (')
Sle_1. Text=string (ldec_wt)
If ls_flag='N' then
St_2. Text='g'
The else
St_2. Text='g'
End the if
The else
Setnull (ldec_wt)
End the if

CodePudding user response:

Use timer timing read ports, the content of the instance variable to hold the read, when end symbol processing, processed to empty instance variables, begin the next reading process
  • Related