+ 1

How to implement an 7+1 bit UART for embedded systems? Will this work?

https://code.sololearn.com/cStyLcatppxF/?ref=app

13th Feb 2022, 2:06 AM
David Ortega
David Ortega - avatar
12 Answers
+ 2
https://www.8051projects.net/t63403/8051-discussion-forum/uartrs232-implementation-7e1.htm
13th Feb 2022, 3:57 AM
Bob_Li
Bob_Li - avatar
+ 1
The parity bit should be the high bit, not the low bit. It should equivalent to: byte |= 1<<7; But the UART chip should handle that for you. Are you making a software UART?
13th Feb 2022, 2:50 AM
Brian
Brian - avatar
+ 1
Now I am a bit puzzled. Are you sure it is 7n1? 7n1 = 7 bits, no parity, 1 stop bit. Your parity bit should be 0.
13th Feb 2022, 3:03 AM
Brian
Brian - avatar
+ 1
Okay, 7e1. So set the parity bit to 1 when needed to make an even number of 1 bits. Can you set the terminal to 7e2? That could help it accommodate for the extra bit from 8n1.
13th Feb 2022, 3:13 AM
Brian
Brian - avatar
+ 1
Not possible to modify the terminal. But 7e1 and 8n1 has the same number of bits. Excuse me if I'm a bit confused, hehe.
13th Feb 2022, 3:21 AM
David Ortega
David Ortega - avatar
+ 1
You may be right. In the history of UARTs, there has been confusing inconsistency like this. Setting 2 stop bits is an old trick to correct some of these mismatches with 7-bit protocol. So, does it help to put the parity in bit7 where it belongs?
13th Feb 2022, 3:30 AM
Brian
Brian - avatar
+ 1
I think it will work but now I can't check it. Thanks a lot for your time.
13th Feb 2022, 3:41 AM
David Ortega
David Ortega - avatar
0
I'm working with a 8051 microcontroller. Differents modes of UART that can be configured are 8n1 and 9n1 but I have to implement a 7E1 UART by software to comunicate with a dumb terminal.
13th Feb 2022, 2:58 AM
David Ortega
David Ortega - avatar
0
Was a mistake, I edit It. I mean 7E1
13th Feb 2022, 3:05 AM
David Ortega
David Ortega - avatar
0
It's a pleasure to help. Let us know how it goes.
13th Feb 2022, 3:56 AM
Brian
Brian - avatar
20th Feb 2022, 2:48 AM
David Ortega
David Ortega - avatar
0
Please see my comments on the code. I think there is a minor bug, and I gave a suggestion to reduce the processing.
20th Feb 2022, 7:10 AM
Brian
Brian - avatar