<< Previous | Next >>

SPIRead

void SPIRead( void * DestAddr, int ByteCount );

Description

Reads a block of bytes from the SPI port. The variable SPIxor needs to be set to either 0x00 or 0xFF depending on whether or not the received signal needs to be inverted. Most applications will not need inversion. SPIinit() sets the value of SPIxor to 0x00.

If SPI_SLAVE_RDY_PORT is defined for a slave device the driver will turn on the bit immediately upon activating the receiver. It will then wait for a byte to become available then turn off the bit. The byte will not be available until the master supplies the 8 clock pulses.

If SPI_SLAVE_RDY_PORT is defined for a master device the driver will wait for the bit to become true before activating the receiver and then wait for it to become false after receiving the byte.

Note for Master: the receiving device Chip Select must already be active

Parameters

DestAddr
Address to store the data

ByteCount
Number of bytes to read

Return value

Master: none.
Slave: 0 = no CS signal, no received bytes.
            1 = CS, bytes received.

Library

SPI.LIB

See also

SPIinit, SPIWrite, SPIWrRd


Dynamic C Functions << Previous | Next >> rabbit.com