Digilent chipKIT Basic I/O Shield Referans Kılavuzu - Sayfa 13

I/O Sistemleri Digilent chipKIT Basic I/O Shield için çevrimiçi göz atın veya pdf Referans Kılavuzu indirin. Digilent chipKIT Basic I/O Shield 14 sayfaları.

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