8051 serial mode 3 used in multi device communication

Papabravo

Joined Feb 24, 2006
21,225
Two things:
The character frame is 11 bits long, including a START bit, 9 databits, and a STOP bit.
There is special hardware to detect when a byte arrives with the most significant bit equal to one.

Have you read the datsheet?
 

Thread Starter

thar07

Joined Jan 3, 2015
71
Two things:
The character frame is 11 bits long, including a START bit, 9 databits, and a STOP bit.
There is special hardware to detect when a byte arrives with the most significant bit equal to one.

Have you read the datsheet?
Yes.

Where do the 9th data bit goes to ?
 

Papabravo

Joined Feb 24, 2006
21,225
The 9th bits for transmit and receive go to Special Function Register SCON(0x98), bits 2 & 3. They are called TB8 and RB8. Where did you think they went? Where else could they go?
 

urb-nurd

Joined Jul 9, 2014
269
Definitely need to check out the datasheet.
It is all in there, just take the time to go through it.

I was doing this just the other week.
 

Thread Starter

thar07

Joined Jan 3, 2015
71
The 9th bits for transmit and receive go to Special Function Register SCON(0x98), bits 2 & 3. They are called TB8 and RB8. Where did you think they went? Where else could they go?

Ok.
Then, how to set the baud rates of the devices (Timer values) ?
 

Papabravo

Joined Feb 24, 2006
21,225
It depends on the 8051 variant we are talking about. My usual point of reference is the Atmel line of second source parts.
http://www.atmel.com/images/doc4316.pdf
On page 2-97 is the baudrate selection diagram. You can use Timer1, Timer2, or the internal baudrate generator.

IIRC the original 8051 from Intel had a more restricted set of choices. There was no Timer2 and no internal baudrate generator. It was common to select odd crystal frequencies so that baudrates would come out correctly with only minor errors.
 
Last edited:

cmartinez

Joined Jan 17, 2007
8,253
... It was common to select odd crystal frequencies so that baudrates would come out correctly with only minor errors.
Good point, I normally only use crystals working at 22.1184 MHz, 14.7456 MHz, 11.0592 MHz and 9.8304 MHz, those values will give you exact common baudrates within reasonable speed ranges in most 8051 MCUs
 
Top