<< Previous | Next >>

SPIWrite

int SPIWrite( void * SrcAddr, int ByteCount );

Description

Write a block of bytes to the SPI port.

If SPI_SLAVE_RDY_PORT is defined for a slave device the driver will turn on the bit immediately after loading the transmit register. It will then wait for the buffer to become available then turn off the bit. The buffer will not become available until the master supplies the first clock.

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

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

Parameters

SrcAddr
Address of data to write.

ByteCount
Number of bytes to write.

Return value

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

Library

SPI.LIB

See also

SPIinit, SPIRead, SPIWrRd


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