8051 serial mode 3 used in multi device communication

Discussion in 'Embedded Systems and Microcontrollers' started by thar07, Apr 3, 2015.

  1. thar07

    Thread Starter Member

    Jan 3, 2015
    71
    0
    How 8051 serial mode 3 can be used in 6 devices communication ?
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    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?
     
    thar07 likes this.
  3. thar07

    Thread Starter Member

    Jan 3, 2015
    71
    0
    Yes.

    Where do the 9th data bit goes to ?
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    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?
     
    thar07 likes this.
  5. urb-nurd

    Member

    Jul 9, 2014
    269
    3
    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.
     
  6. thar07

    Thread Starter Member

    Jan 3, 2015
    71
    0

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

    Expert

    Feb 24, 2006
    10,135
    1,786
    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: Apr 5, 2015
    thar07 likes this.
  8. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,554
    2,504
    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
     
Loading...