SERIAL
COMMUNICATION IN
8051
8051 has an internal serial port Which can operated 4 modes.
Baud rates for serial communication programmable using internal
timer-1.
8051 can be used as a full-duplex serial communication devices.
A system Requires:
Internal program memory,
RS232 level converter like MAX 232.
A quartz crystal and a reset circuit should be connected to controller.
Program for serial communication  stored permanently in the
internal ROM.
Serial bus formed by using TXD, RxD and Vss.
If any additional signals required  generated by software and output/input
through port pins.
TxD, RxD TTL logic levels. converted to standard RS232 logic levels
using bi directional level converter MAX 232.
RS232 level serial port signal can be terminated on a standard 9-pin D-type
Connector.(any serial device connected to 8051)
Parallel data transfer can be achieved through ports.
Parallel input data  received through port-2
Parallel output data  sent through port-1.
Example:
Controller receive parallel data from an ADC. convert it to serial.
transmit via the serial port to another serial devices.
Also controller receive  serial data  from other serial devices via serial
port, convert to parallel…. Then outputs through port-1 to a parallel devices
like DAC.
Supports full duplex communication transmission and reception perform
simultaneously.
Serial Data Buffer (SBUF) register
SBUF used to hold Parallel data during transmission and
reception.
During Serial Reception:
Serial data  received  via RxD pin.
Converted to parallel data  stored in receive buffer.
During serial transmission:
parallel data  stored in transmit buffer
converted to serial data to transmit via TxD pin.
Transmit and receive buffers  assigned the same internal address
99H.
Transmit buffer only for  write operation
Receive buffer only for  Read operation.
Power Control Register(PCON)
SMOD  used decide the baud rate in serial port operating modes
1,2,3
In Mode 2:
If SMOD=0 baud rate=1/64 of the oscillator frequency
If SMOD=1 Baud rate=1/32 of the oscillator frequency.
In Mode 1 & 3: baud rate depends on SMOD and timer-1 overflow
rate.Baud rate(mode 1 or 3)=(2^SMOD/32)*timer-1 overflow rate.
Timer-1  auto reload mode.
Timer-1 over flow rate= oscillator frequency/12*[256-(TH1)^2]
TH1 reload count value -8 bit in higher order timer-1 count register.
Half duplex
Full duplex
10 bit, 11 bit

Serial communication in 8051 microcontroller .pptx

  • 1.
  • 2.
    8051 has aninternal serial port Which can operated 4 modes. Baud rates for serial communication programmable using internal timer-1. 8051 can be used as a full-duplex serial communication devices. A system Requires: Internal program memory, RS232 level converter like MAX 232. A quartz crystal and a reset circuit should be connected to controller. Program for serial communication  stored permanently in the internal ROM.
  • 3.
    Serial bus formedby using TXD, RxD and Vss. If any additional signals required  generated by software and output/input through port pins. TxD, RxD TTL logic levels. converted to standard RS232 logic levels using bi directional level converter MAX 232. RS232 level serial port signal can be terminated on a standard 9-pin D-type Connector.(any serial device connected to 8051) Parallel data transfer can be achieved through ports. Parallel input data  received through port-2 Parallel output data  sent through port-1. Example: Controller receive parallel data from an ADC. convert it to serial. transmit via the serial port to another serial devices. Also controller receive  serial data  from other serial devices via serial port, convert to parallel…. Then outputs through port-1 to a parallel devices like DAC. Supports full duplex communication transmission and reception perform simultaneously.
  • 4.
    Serial Data Buffer(SBUF) register SBUF used to hold Parallel data during transmission and reception. During Serial Reception: Serial data  received  via RxD pin. Converted to parallel data  stored in receive buffer. During serial transmission: parallel data  stored in transmit buffer converted to serial data to transmit via TxD pin. Transmit and receive buffers  assigned the same internal address 99H. Transmit buffer only for  write operation Receive buffer only for  Read operation.
  • 5.
    Power Control Register(PCON) SMOD used decide the baud rate in serial port operating modes 1,2,3 In Mode 2: If SMOD=0 baud rate=1/64 of the oscillator frequency If SMOD=1 Baud rate=1/32 of the oscillator frequency. In Mode 1 & 3: baud rate depends on SMOD and timer-1 overflow rate.Baud rate(mode 1 or 3)=(2^SMOD/32)*timer-1 overflow rate. Timer-1  auto reload mode. Timer-1 over flow rate= oscillator frequency/12*[256-(TH1)^2] TH1 reload count value -8 bit in higher order timer-1 count register.
  • 6.