Digilent chipKIT Basic I/O Shield 참조 매뉴얼 - 페이지 13

{카테고리_이름} Digilent chipKIT Basic I/O Shield에 대한 참조 매뉴얼을 온라인으로 검색하거나 PDF를 다운로드하세요. Digilent chipKIT Basic I/O Shield 14 페이지.

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