Page 302 of 346 Start Back Next End ZBasic System Library 290 ZBasic Microcontrollers SPIStop Type Subroutine Invocation SPIStop(channel, flags) Parameter Method Type Description channel ByVal Byte The SPI channel number (1-4). flags ByVal Byte The number of bytes to write (0 – 65535). Discussion If the specified channel is valid and is open, this subroutine modifies the state of the SPI interface according to the bits that are on in the flags parameter as described below. If multiple bits are on in the flags parameter they are processed in order from most significant to least significant. Flag Parameter Action Bits Hex Value Binary Value Description &H01 xx xx xx x1 Deinitialize the SPI controller associated with the channel (ignored for a software channel). &H02 xx xx xx 1x Deassert the chip select pin associated with the channel. For compatiblility with future enhancements the unused bits in the flags parameter should always be zero. Note that this is a low level routine that must be used in concert with other low level routines to effect an SPI bus transaction. Example Call OpenSPI(1, 0, 12) Call SPIStop(1, &H03) In this example idata is not initialized before calling SPICmd(). If your SPI device needs specific data written to it during the read phase, idata would need to be initialized before the call. Compatibility This routine is not available in BasicX compatibility mode nor it is available for VM devices. See Also CloseSPI, OpenSPI, SPIGetByte, SPIPutByte, SPIGetData, SPIPutData, SPIStart