Serial Communication Bus-Interface (Unit3)
Serial Communication Bus-Interface (Unit3)
Interface
Serial Communication standards
Serial Data Transfer scheme
On-board communication Interfaces-I2C Bus,SPI Bus,UART
External Communication Interfaces-RS-232,USB
1
DATA COMMUNICATION
• The 8051 microcontroller is a parallel device that transfers
eight bits of data simultaneously over eight data lines to
parallel I/O devices.
• The parallel I/O devices are printer, D/A converter and
stepper motor.
• However, in many situations, parallel data transfer is
impractical. For example, parallel data transfer over a long
distance is very expensive.
• Hence, serial data communication is widely used in long
distance data communication, and in this mode, one bit of
information, at a time is transferred over a single line.
17
Serial Peripheral Interface (SPI)
4 interface pins:
-MOSI master out slave in
-MISO master in slave out
-SCK serial clock
-SS_n slave select
3 registers:
-SPCR control register
-SPSR status register
-SPDR data register
Serial Peripheral Interface (SPI)
Data is shifted out of the master's (mega128) MOSI pin and in its MISO pin
Data transfer is initiated by simply writing data to the SPI data register.
To get input data only you send “junk” data to SPDR to start the clock.
Serial Peripheral Interface
• Allows transfer of information, 8 bits at a time, between microcontroller and
any number of peripherals
• Read and Write operations happen simultaneously
• Using chip selects allows lots of peripherals to be connected to a single SPI
bus at the same time
• Has no start/stop bit overhead
• High data rates: 250Kbit to 2Mbit/sec
• Common uses:
– Inter-Processor Network
– Sending MP3 data to MP3 decoders
– Interfacing to external serial RAM/EEPROM/FLASH
– Interfacing to serial graphic LCDs
– Compatible with thousands of chips with SPI, Microwire, I2S, and other serial
interfaces
SPI and Microcontrollers
29
RS232
• RS232 is the most widely used serial I/O interfacing
standard. The RS232 standard was published by the
Electronic Industry Association (EIA) in 1960.
• The COM1 and COM2 ports in IBMPC are RS232
compatible ports. In RS232, 1 is represented by –3 to –25
V and 0 is represented by +3 to +25 V.
• In a microcontroller, serial TXD and RXD lines are TTL
compatible i.e. 1 and 0 are represented by +5 V and 0 V.