Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Soft_SPI_Read
Soft_SPI_Write
361
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function Soft_SPI_Read(sdata: byte): word;
Returns
Byte received via the SPI bus.
Description
This routine performs 3 operations simultaneously. It provides clock for the Soft-
ware SPI bus, reads a byte and sends a byte.
Parameters : 
sdata
: data to be sent. 
Requires
Soft SPI must be initialized before using this function. See Soft_SPI_Init routine.
Example
var data_read : word;
data_send : byte;
...
// Read a byte and assign it to data_read variable
// (data_send byte will be sent via SPI during the Read opera-
tion)
data_read := Soft_SPI_Read(data_send);
Prototype
procedure Soft_SPI_Write(sdata: byte);
Returns
Nothing.
Description
This routine sends one byte via the Software SPI bus.
Parameters : 
sdata
: data to be sent. 
Requires
Soft SPI must be initialized before using this function. See Soft_SPI_Init routine.
Example
// Write a byte to the Soft SPI bus
Soft_SPI_Write(0xAA);