Syntax:
SPI2Transfer
tx, rx
Command Availability:
Available on Microchip PIC microcontrollers with Hardware SPI modules.
Explanation:
This command simultaneously sends and receives a byte of data using the
SPI protocol. It behaves differently depending on whether the microcontroller has
been set to act as a master or a slave.
When operating as a master, SPI2Transfer
will initiate a transfer. The
data in tx
will be sent to the slave, whilst the byte that is buffered
in the slave will be read into rx
.
In slave mode, the SPI2Transfer
command will pause the program until a
transfer is initiated by the master. At this point, it will send the
data in tx
whilst reading the transmission from the master into the
rx
variable.
See also SPIMode,FastHWSPI2Transfer