![]() ZBasic System Library
303
ZBasic Microcontrollers
Type
Function returning UnsignedInteger
Invocation
SPIPutData(channel, writeCnt, writeData)
Parameter
Method
Type
Description
channel
ByVal
Byte
The SPI channel number (1-4).
writeCnt
ByVal
integral
The number of bytes to write (0 65535).
writeData
ByRef
any type
The variable containing the data to write to the slave device.
Discussion
This function sends the specified number of bytes to an SPI slave from the variable provided (typically a
Byte array) discarding the data returned by the slave in response to each byte sent. The value returned
is equal to the number of bytes sent to the slave. If the channel number is invalid or the channel is not
properly prepared, 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 odata(1 to 2) as Byte
Call OpenSPI(1, 0, 12)
Call SPIStart(1, &H03)
odata(1) = &H06
odata(2) = &H00
Call SPICmd(1, 2, odata)
Compatibility
This routine is not available in BasicX compatibility mode nor it is available for VM devices.
See Also
|