/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void SpiWrite(uint8 spi_in)
{
SPI1DAT = spi_in;
while( SPIF1 == 0);
SPIF1 = 0;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
uint8 SpiReadWrite(uint8 spi_in)
{
SPI1DAT = spi_in;
while( SPIF1 == 0);
SPIF1 = 0;
return SPI1DAT;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void SpiRfWriteAddressData(uint8 address, uint8 d)
{
RF_NSEL_PIN = 0;
SpiWrite(address);
SpiWrite(d);
RF_NSEL_PIN = 1;
}
void SpiWrite(uint8 spi_in)
Sends 8 bits length data through the SPI port
Data
None
It doesn't control the nSEL pin
uint8 SpiReadWrite(uint8 data)
Sends and read 8 bits length data through the SPI port
Data
Received byte
It doesn't control the nSEL pin
void SpiRfWriteAddressData(uint8 address, uint8 data1)
Sends 16 length data through the SPI port (address and data)
Address - register address
Data - 8bit data
None
It controls the nSEL pin
Rev. 0.3
SDBC-DK3 UG
//write data into the SPI register
//wait for sending the data
//clear interrupt flag
//write data into the SPI register
//wait for sending the data
//clear interrupt flag
//read received bytes
71
Need help?
Do you have a question about the C8051F930 and is the answer not in the manual?