![codevision wikipedia codevision wikipedia](http://runnerenergy379.weebly.com/uploads/1/2/3/9/123988197/193512793.jpg)
Bit 3 – CPOL: Clock Polarity Bit 2 – CPHA: Clock Phase Bits 1, 0 – SPR1, SPR0: SPI Clock Rate Select 1 and 0 The user will then have to set MSTR to re-enable SPI Master mode. If SS is configured as an input and is driven low while MSTR is set, MSTR will be cleared, and SPIF in SPSR will become set. This bit selects Master SPI mode when written to one, and Slave SPI mode when written logic zero. Bit 5 – DORD: Data Order Bit 4 – MSTR: Master/Slave Select This bit must be set to enable any SPI operations. When the SPE bit is written to one, the SPI is enabled. This bit causes the SPI interrupt to be executed if SPIF bit in the SPSR Register is set and the if the global interrupt enable bit in SREG is set. When the SPI is configured as Slave, the SPI is only guaranteed to work at or lower. This means that the minimum SCK period will be 2 CPU clock periods. When this bit is written logic one the SPI speed (SCK Frequency) will be doubled when the SPI is in Master mode. Bit 5.1 – Res: Reserved Bits Bit 0 – SPI2X: Double SPI Speed Bit The WCOL bit (and the SPIF bit) are cleared by first reading the SPI Status Register with WCOL set, and then accessing the SPI Data Register. The WCOL bit is set if the SPI Data Register (SPDR) is written during a data transfer. Alternatively, the SPIF bit is cleared by first reading the SPI Status Register with SPIF set, then accessing the SPI Data Register (SPDR). SPIF is cleared by hardware when executing the corresponding interrupt Handling Vector. If SS is an input and is driven low when the SPI is in Master mode, this will also set the SPIF Flag. An interrupt is generated if SPIE in SPCR is set and global interrupts are enabled.
#CODEVISION WIKIPEDIA SERIAL#
When a serial transfer is complete, the SPIF Flag is set. So let’s see, what are the available resources for this communication. There would be a master device that will transmit a string of character, either once, or repetitively. As the receiver system will never transmit any data, we can keep it enabled all the time. So the receiver circuit is essentially a slave. And it displays the character on the LCD display. Here, in this experiment, one system is build up to receive any character transmitted in the SPI. The clocking signal is generated by the master in the network. An SPI bus consist of two DATA lines, one clock line, and device select (or slave select) lines. If the system is a multi-master network, then each individual secondary master needs to be selected for mastering the SPI BUS. Irrespective of the device attached as a slave, it needs to get selected by master device(s) for data transfer.
![codevision wikipedia codevision wikipedia](https://i.pinimg.com/474x/05/26/5e/05265ea46d3b191b45b88e7da7401b77.jpg)
It can be an SD card, or some display device or may be some other electronic circuit. The slave need not to be another micro controller. There can be multiple Masters in a system. For more elaboration, you may read the Wikipedia article: Serial Peripheral Interface Bus. The device or devices that controls the operation inside the network is known as the Master. These data registers works as shift registers and one of the device controls the data exchange inside the SPI Network. 8bit data registers in the devices are connected by wires. SPI stands for Serial Peripheral Interface and it is the simplest among all the communication protocols. Most of the time, microcontrollers come along with internal modules that support these protocols.
![codevision wikipedia codevision wikipedia](https://image.slidesharecdn.com/cvavrmanual-130814145730-phpapp02/95/cvavrmanual-19-638.jpg)
Micro controllers support wired communication protocols.