Display controller initialization – Digilent 410-216P-KIT User Manual
Page 11
chipKIT Basic I/O Shield Reference Manual
www.digilentinc.com
page 11 of 15
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
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.
*/
PORTClearBits(prtVddCtrl, bitVddCtrl);
DelayMs(1);
/* Display off command
*/
Spi2PutByte(0xAE);
/* Bring Reset low and then high
*/
PORTClearBits(prtReset, bitReset);
DelayMs(1);
PORTSetBits(prtReset, bitReset);
/* Send the Set Charge Pump and Set Pre-Charge Period commands
*/
Spi2PutByte(0x8D);
Spi2PutByte(0x14);
Spi2PutByte(0xD9);
Spi2PutByte(0xF1);
/* Turn on VCC and wait 100ms
*/
PORTClearBits(prtVbatCtrl, bitVbatCtrl);
DelayMs(100);
/* Send the commands to invert the display. This puts the display origin
** in the upper left corner.
*/