Datasheet
SPI LIBRARY
mikroC PRO for AVR provides a library for comfortable with SPI work in Master mode. The AVR
MCU can easily communicate with other devices via SPI: A/D converters, D/A converters,
MAX7219, LTC1290, etc.
Note: Some AVR MCU's have alternative SPI ports, which SPI signals can be redirected to by
setting or clearing SPIPS (SPI Pin Select) bit of the MCUCR register. Please consult the appro-
priate datasheet.
Library Routines
- SPI1_Init
- SPI1_Init_Advanced
- SPI1_Read
- SPI1_Write
SPI1_Init
426
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
void SPI1_Init();
Returns Nothing.
Description
This routine configures and enables SPI module with the following settings:
- master mode
- 8 bit data transfer
- most significant bit sent first
- serial clock low when idle
- data sampled on leading edge
- serial clock = fosc/4
Requires MCU must have SPI module.
Example
// Initialize the SPI1 module with default settings
SPI1_Init();