User manual

471
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
SPIx_Read
SPIx_Write
Prototype
function SPIx_Read(data_out: word): word;
Description Reads one word or byte (depending on mode set by init routines) from the SPI bus.
Parameters - data_out: dummy data for clock generation (see device Datasheet for SPI modules implementation
details)
Returns Received data.
Requires Routine requires at least one SPI module.
Used SPI module must be initialized before using this function. See the SPIx_Init and SPIx_Init_
Advanced routines.
Example
// read a byte from the SPI bus
var take, buffer : byte;
...
take := SPI1_Read(buffer);
Notes SPI library routines require you to specify the module you want to use. To select the desired SPI
module, simply change the letter x in the routine prototype for a number from 1 to 3.
Number of SPI modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.
Prototype
procedure SPIx_Write(data_out : word);
Description Writes one word or byte (depending on mode set by init routines) via the SPI bus.
Parameters - data_out: data to be sent
Returns Received data.
Requires Routine requires at least one SPI module.
Used SPI module must be initialized before using this function. See the SPIx_Init and SPIx_Init_
Advanced routines.
Example
// write a byte to the SPI bus
var buffer : byte;
...
SPI1_Write(buffer);
Notes SPI library routines require you to specify the module you want to use. To select the desired SPI
module, simply change the letter x in the routine prototype for a number from 1 to 3.
Number of SPI modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.