Download Print this page

Digilent chipKIT Basic I/O Shield Reference Manual page 13

Advertisement

chipKIT™ Basic I/O Shield™ Reference Manual
void
OledPutBuffer(int cb, BYTE * rgbTx)
{
int
ib;
BYTE bTmp;
/* Write/Read the data
*/
for (ib = 0; ib < cb; ib++) {
/* Wait for transmitter to be ready
*/
while (SPI2STATbits.SPITBE == 0);
/* Write the next transmit byte.
*/
SPI2BUF = *rgbTx++;
/* Wait for receive byte.
*/
while (SPI2STATbits.SPIRBF == 0);
bTmp = SPI2BUF;
}
}
/* ------------------------------------------------------------ */
/*** Spi2PutByte
**
**
Parameters:
**
bVal
- byte value to write
**
**
Return Value:
**
Returns byte read
**
**
Errors:
**
none
**
**
Description:
**
Write/Read a byte on SPI port 2
*/
BYTE
Spi2PutByte(BYTE bVal)
{
BYTE bRx;
/* Wait for transmitter to be ready
*/
while (SPI2STATbits.SPITBE == 0);
/* Write the next transmit byte.
*/
SPI2BUF = bVal;
/* Wait for receive byte.
*/
while (SPI2STATbits.SPIRBF == 0);
/* Put the received byte in the buffer.
*/
bRx = SPI2BUF;
return bRx;
}
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 13 of 13

Advertisement

loading
Need help?

Need help?

Do you have a question about the chipKIT Basic I/O Shield and is the answer not in the manual?

Questions and answers