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 0x7Eto 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 availableandread 1 bytesetc. 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login