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

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

chipKIT™ Basic I/O Shield™ Reference Manual
void
OledHostInit()
{
unsigned int
tcfg;
/* Initialize SPI port 2.
*/
SPI2CON = 0;
SPI2BRG = 15;
SPI2STATbits.SPIROV = 0;
SPI2CONbits.CKP = 1;
SPI2CONbits.MSTEN = 1;
SPI2CONbits.ON = 1;
/* Make pins RF4, RF5, and RF6 be outputs.
*/
PORTSetBits(IOPORT_F, bitVddCtrl|bitVbatCtrl|bitDataCmd);
PORTSetPinsDigitalOut(prtDataCmd, bitDataCmd);
PORTSetPinsDigitalOut(prtVddCtrl, bitVddCtrl);
(1=off)
PORTSetPinsDigitalOut(prtVbatCtrl, bitVbatCtrl);
(1=off)
/* Make the RG9 pin be an output. On the Basic I/O Shield, this pin
** is tied to reset.
*/
PORTSetBits(prtReset, bitReset);
PORTSetPinsDigitalOut(prtReset, bitReset);
}
Display Controller Initialization
The following function performs initialization of the display controller on the display panel. This performs the
power up sequence on the display and initializes it for a non-interleaved display buffer with the origin in the upper
left corner.
/* ------------------------------------------------------------ */
/*** OledDspInit
**
**
Parameters:
**
none
**
**
Return Value:
**
none
**
**
Errors:
**
none
**
**
Description:
**
Initialize the OLED display controller and turn the display on.
*/
void
OledDspInit()
{
/* We're going to be sending commands, so clear the Data/Cmd bit
*/
PORTClearBits(prtDataCmd, bitDataCmd);
/* Start by turning VDD on and wait a while for the power to come up.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
//8Mhz, with 80Mhz PB clock
//Data/Command# select
//VDD power control
//VBAT power control
Page 10 of 13