How to set end of line character in UART
-
I'm using UI flow 2.0. My UART device has special ascii char for end of line (0x7E). I believe EOL is detected using line feed by default 0x0A.. Is there a way to set custom end of line character in the UART initialization?
uart1 = UART(1, baudrate=115200, bits=8, parity=None, stop=1, tx=32, rx=26, txbuf=256, rxbuf=256, timeout=0, timeout_char=0, invert=0, flow=0)
-
Hello @digiajay
you can use
UART x write ""
block which will send data without line end and then useUART x write raw Data 0x7E
to send the special line end.Thanks
Felix -
@felmue Sorry, this is for reading from UART device.. It's UHF RFID reader device that sends newly read tag data with 7E at the end.
-
Hello @digiajay
ok, understood.
Well, you cannot set a different EOL character and therefore you cannot use UART block
read line
.However you can use block
count of available
andread 1 bytes
etc. to read chars sent from your device. As long as the char received is not your EOL char, append them into a buffer. And when you receive your EOL char do something with the chars accumulated in the buffer, then clear the buffer and start over.Thanks
Felix