-->
Page 1 of 1

How do I detect receipt of a break character in serial read?

PostPosted: Thu Oct 01, 2020 1:29 am
by mchahn
I have googled uart breaks on esp8266 and found that support is lacking for break characters in general. Correct me if I'm wrong.

I've seen two methods to send a break, both of which are messy. One is to send a zero byte with a slow baud rate. The other method is to turn off serial, use the gpio, and turn serial back on. I will use one of these ugly methods to send breaks.

However, I can't find anything about how to detect a break when receiving. From my testing it appears that Serial.read() just returns a byte value of zero which is useless.

Does anyone know a way to detect a received break? I'm stuck on this because the protocol I'm receviing uses breaks to separate transmissions.

Re: How do I detect receipt of a break character in serial r

PostPosted: Sat Oct 03, 2020 8:47 pm
by mrburnette
https://en.wikipedia.org/wiki/Break_key

As there are multiple implementations, I would try to detect Ctrl-C as that is most likely the better choice. Otherwise, you can create a sketch that reads all characters and output the ASCII code to a display.

You can modify my project to output ASCII numbers for non-printable characters.

https://www.hackster.io/rayburne/the-qbf-signal-generator-ae7015

Re: How do I detect receipt of a break character in serial r

PostPosted: Wed Oct 14, 2020 6:18 pm
by mchahn
Thanks, but I am talking about the 10-bit low on the serial line, not any ascii character which fits in 8 bits.

https://en.wikipedia.org/wiki/Universal ... _condition