Mikroelektronika MIKROE-742 데이터 시트
Library Routines
- Soft_SPI_Init
- Soft_SPI_Read
- Soft_SPI_Write
- Soft_SPI_Read
- Soft_SPI_Write
Soft_SPI_Init
360
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Soft_SPI_Init();
Returns
Nothing.
Description
Configures and initializes the software SPI module.
Requires
Global variables:
-
Chip_Select
: Chip select line
-
SoftSpi_SDI
: Data in line
-
SoftSpi_SDO
: Data out line
-
SoftSpi_CLK
: Data clock line
-
Chip_Select_Direction
: Direction of the Chip select pin
-
SoftSpi_SDI_Direction
: Direction of the Data in pin
-
SoftSpi_SDO_Direction
: Direction of the Data out pin
-
SoftSpi_CLK_Direction
: Direction of the Data clock pin
must be defined before using this function.
Example
// soft_spi pinout definition
var Chip_Select : sbit at PORTB.B0;
var SoftSpi_SDI : sbit at PINB.B6;
var SoftSpi_SDO : sbit at PORTB.B5;
var SoftSpi_CLK : sbit at PORTB.B7;
var Chip_Select_Direction : sbit at DDRB.B0;
var SoftSpi_SDI_Direction : sbit at DDRB.B6;
var SoftSpi_SDO_Direction : sbit at DDRB.B5;
var SoftSpi_CLK_Direction : sbit at DDRB.B7;
var Chip_Select : sbit at PORTB.B0;
var SoftSpi_SDI : sbit at PINB.B6;
var SoftSpi_SDO : sbit at PORTB.B5;
var SoftSpi_CLK : sbit at PORTB.B7;
var Chip_Select_Direction : sbit at DDRB.B0;
var SoftSpi_SDI_Direction : sbit at DDRB.B6;
var SoftSpi_SDO_Direction : sbit at DDRB.B5;
var SoftSpi_CLK_Direction : sbit at DDRB.B7;
...
Soft_SPI_Init(); // Init Soft_SPI