![]() ZBasic System Library
285
ZBasic Microcontrollers
Type
Function returning Byte
Invocation
SPIGetByte(channel, writeData) or
SPIGetByte(channel)
Parameter
Method
Type
Description
channel
ByVal
Byte
The SPI channel number (1-4).
writeData
ByVal
Byte
The data value to send to the slave for each byte received.
Discussion
This function sends a byte of data to an SPI slave and returns the value sent back by the SPI slave. For
the second form, the data byte sent while receiving is zero. If the channel number is invalid or the
channel is not open, the return value is zero. Note that this is a low level function that must be used in
concert with other low level routines to effect an SPI bus transaction.
Example
Dim b as Byte
Call OpenSPI(1, 0, 12)
Call SPIStart(1, &H03)
b = SPIGetByte(1, &Hff)
Compatibility
This routine is not available in BasicX compatibility mode nor it is available for VM devices.
See Also
|