Mikroelektronika MIKROE-742 데이터 시트
SOFTWARE SPI LIBRARY
The mikroPacal PRO for AVR provides routines for implementing Software SPI com-
munication. These routines are hardware independent and can be used with any
MCU. The Software SPI Library provides easy communication with other devices via
SPI: A/D converters, D/A converters, MAX7219, LTC1290, etc.
munication. These routines are hardware independent and can be used with any
MCU. The Software SPI Library provides easy communication with other devices via
SPI: A/D converters, D/A converters, MAX7219, LTC1290, etc.
Library configuration:
- SPI to Master mode
- Clock value = 20 kHz.
- Data sampled at the middle of interval.
- Clock idle state low.
- Data sampled at the middle of interval.
- Data transmitted at low to high edge.
- Clock value = 20 kHz.
- Data sampled at the middle of interval.
- Clock idle state low.
- Data sampled at the middle of interval.
- Data transmitted at low to high edge.
Note: The Software SPI library implements time-based activities, so interrupts need
to be disabled when using it.
to be disabled when using it.
External dependencies of Software SPI Library
359
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
The following variables
must be defined in all
projects using Software
SPI Library:
Description:
Example :
var Chip_Select :
sbit; sfr; external;
sbit; sfr; external;
Chip select line.
var Chip_Select :
sbit at PORTB.B0;
sbit at PORTB.B0;
var SoftSpi_SDI :
sbit; sfr; external;
sbit; sfr; external;
Data In line.
var SoftSpi_SDI :
sbit at PINB.B6;
sbit at PINB.B6;
var SoftSpi_SDO :
sbit; sfr; external;
sbit; sfr; external;
Data Out line.
var SoftSpi_SDO :
sbit at PORTB.B5;
sbit at PORTB.B5;
var SoftSpi_CLK :
sbit; sfr; external;
sbit; sfr; external;
Clock line.
var SoftSpi_CLK :
sbit at PORTB.B7;
sbit at PORTB.B7;
var
Chip_Select_Direction
:
Chip_Select_Direction
:
sbit; sfr; external;
Direction of the Chip
Select pin.
Select pin.
var
Chip_Select_Direction
:
Chip_Select_Direction
:
sbit at DDRB.B0;
var
SoftSpi_SDI_Direction
SoftSpi_SDI_Direction
:
sbit; sfr; external;
Direction of the Data In pin.
var
SoftSpi_SDI_Direction
SoftSpi_SDI_Direction
:
sbit at DDRB.B6;
var
SoftSpi_SDO_Direction
SoftSpi_SDO_Direction
:
sbit; sfr; external;
Direction of the Data Out pin
var
SoftSpi_SDO_Direction
SoftSpi_SDO_Direction
:
sbit at DDRB.B5;
var
SoftSpi_CLK_Direction
SoftSpi_CLK_Direction
:
sbit; sfr; external;
Direction of the Clock pin.
var
SoftSpi_CLK_Direction
SoftSpi_CLK_Direction
:
sbit at DDRB.B7;