How to use SPI (Serial Peripheral Interface) in AVR Microcontrollers

Posted on Feb 6, 2014

SPI stands for Serial Peripheral Interface and it is the simplest among all the communication protocols. 8bit data registers in the devices are connected by wires. These data registers works as shift registers and one of the device controls the data exchange inside the SPI Network. The device or devices that controls the operation inside the netwo

How to use SPI (Serial Peripheral Interface) in AVR Microcontrollers
Click here to download the full size of the above Circuit.

rk is known as the Master. For more elaboration, you may read the Wikipedia article: Serial Peripheral Interface Bus. There can be multiple Masters in a system. There may be multiple slaves too. The slave need not to be another micro controller. It can be an SD card, or some display device or may be some other electronic circuit. Irrespective of the device attached as a slave, it needs to get selected by master device(s) for data transfer. If the system is a multi-master network, then each individual secondary master needs to be selected for mastering the SPI BUS. An SPI bus consist of two DATA lines, one clock line, and device select (or slave select) lines. The clocking signal is generated by the master in the network. Here, in this experiment, one system is build up to receive any character transmitted in the SPI. And it displays the character on the LCD display. So the receiver circuit is essentially a slave. As the receiver system will never transmit any data, we can keep it enabled all the time. There would be a master device that will transmit a string of character, either once, or repetitively. So let`s see, what are the available resources for this communication. When a serial transfer is complete, the SPIF Flag is set. An interrupt is generated if SPIE in SPCR is set and global interrupts are enabled. If SS is an input and is driven low when the SPI is in Master mode, this will also set the SPIF Flag. SPIF is...

Leave Comment

characters left:

Related Circuits

  • New Circuits



    Popular Circuits

    12VDC Fluorescent Lamp Driver
    Photocell Amplifier
    Spider robot with PIC16F84
    4-Decade Square-Wave Generator
    Yamaha Wiring System
    basic circuit diagram for pc to microcontroller communication
    5.3W Amplifier With Surround System
    Adjustable Voltage Step-down Converter
    Build an Experimenters Power Supply
    Analog to Digital Converters