I send a data from the serial port as
1H|\^&|||c111^Roche^c111^2.0.0.0710^1^3334
44|||||host|TSREQ^REAL|
To serial port and at receiving end string got split as
1H|\^
and
&|||c111^Roche^c111^2.0.0.0710^1^3334
44|||||host|TSREQ^REAL|
why it happened, i want to send it as a single string.
This is my code
import serial
import requests
ser = serial.Serial(port='COM1',baudrate=9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=0.5)
concat = str()
concat01=str()
header = "b'\x021H|\^&||||||||||P||'\r\n"
sample = "b'\x023Q|1|^0101645900^10^0^4^^SAMPLE^NORMAL||ALL||||||||O'\r\n"
eol="b'\x024L|1|I'\r\n"
patient_info = "b'\x022P|1'\r\n"
while 1:
z=ser.readline()
print(z)
print("Str Result",str(z))
if str(z)!="b''":
if str(z) == str(b'\x06'):
print("verfied 06")
concat = header + patient_info + sample + eol
ser.write(concat.encode())