Microprocessors And Microcontrollers...Microprocessors And Microcontrollers By: Dr. Attiya Baqai...

Post on 05-Aug-2020

24 views 1 download

Transcript of Microprocessors And Microcontrollers...Microprocessors And Microcontrollers By: Dr. Attiya Baqai...

Microprocessors And Microcontrollers

By: Dr. Attiya Baqai

Semester : 4th , 5th (TL, ES) Assistant Professor,

Course Code : ES256 , ES313 Department of

Electronics, MUET.

SPI (Serial Peripheral Interfacing) Protocol

SPI Characteristics

◉ 4 wire SPI interface bus

◉ 3 wire SPI interface bus

◉ Synchronous serial communication.

◉ used for quick access over short distances.

◉ used for communication between two microcontrollers.

◉ Between Microcontrollers & small peripherals, such as shift registers, sensors, Ethernet module and SD cards.

SPI Characteristics

SPI Characteristics

ADC interfacing with Raspberry Pi using SPI

SPI Characteristics

Single master, multi slave configuration using SPI

SPI in Master Slave configuration

SPI in Master Slave configuration

SPI Read/ Write

Single Byte Write

Multi Byte Write

Single Byte Read

Multi Byte Read

SPI Programming

◉ SPI Registers

◉SPSR (SPI Status Register)

◉SPCR (SPI Control Register)

◉SPDR (SPI Data Register)

Concept of Resolution

SPI Transmission modes

These modes control

◉ whether data is shifted in and out on the rising or falling edge of the data clock signal (called the clock phase), and

◉whether the clock is idle when high or low (called the clock polarity).

SPI Data Register

Programming steps

◉For Master Mode, make pin MOSI and SCK as Output

◉For Slave Mode, make pin MISO as output.

◉Configure SPCR

◉Write Data in SPDR and Wait for Data Receive/Transmit complete SPIF (SPSR)

◉Read data from SPDR

Any questions ?

Thanks!