Hi,
i am unable to get the CFAL12832D-B working with my PIC18F25K50 (the OLED was bought directly from CF).
as attached are the schematic for the OLED connection with the PIC. a level shifter CD4050 are used since the PIC is powered with 5V.
Please help, TQ.
p/s: for initial testing, i bought the OLED already connected with a break-out board from adafruit (https://www.adafruit.com/products/661) and connected it with dsPIC30F6014A. with below programming code, the display works.
here is the programming:

i am unable to get the CFAL12832D-B working with my PIC18F25K50 (the OLED was bought directly from CF).
as attached are the schematic for the OLED connection with the PIC. a level shifter CD4050 are used since the PIC is powered with 5V.
Please help, TQ.
p/s: for initial testing, i bought the OLED already connected with a break-out board from adafruit (https://www.adafruit.com/products/661) and connected it with dsPIC30F6014A. with below programming code, the display works.
here is the programming:
Code:
#include <test1.h>
#define DC PIN_A1
#define RES PIN_A2
#define CS1 PIN_C7
void WriteCommand(byte command)
{
OUTPUT_LOW(CS1); // chip selected
OUTPUT_LOW(DC); // command mode
spi_write(command); // set up data on bus
OUTPUT_HIGH(CS1); // deselect chip
}
void WriteData(byte data)
{
OUTPUT_LOW(CS1); // chip selected
OUTPUT_HIGH(DC); // data mode
spi_write(data); // set up data on bus
OUTPUT_HIGH(CS1); // deselect chip
}
void reset_display(void)
{
OUTPUT_LOW(RES);
delay_ms(10000);
OUTPUT_HIGH(RES);
delay_ms(10000);
}
void init_OLED(void)
{
WriteCommand(0xAE); //--Set Display off
WriteCommand(0x00); //--set low column address
WriteCommand(0x10); //--set high column address
WriteCommand(0x81); //--set contrast control register
WriteCommand(0x7f);
WriteCommand(0xa1); //--set segment re-map 95 to 0
WriteCommand(0xA6); //--set normal display
WriteCommand(0xa8); //--set multiplex ratio(1 to 16)
WriteCommand(0x1f); //--duty 1/32
WriteCommand(0xd3); //--set display offset
WriteCommand(0x00); //--not offset
WriteCommand(0xd5); //--set display clock divide ratio/oscillator frequency
WriteCommand(0xf0); //--set divide ratio
WriteCommand(0xd9); //--set pre-charge period
WriteCommand(0x22);
WriteCommand(0xda); //--set com pins hardware configuration
WriteCommand(0x02); //disable left/right remap and set for sequential
WriteCommand(0xdb); //--set vcomh
WriteCommand(0x49); //--0.83*vref
WriteCommand(0x8d); //--set DC-DC enable
WriteCommand(0x14);
WriteCommand(0xAF); //--turn on oled panel
WriteCommand(0xA4); //--Entire Display ON
}
byte boot_logo[4][132] =
{
{0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0x0C,0x06,0x03,0x01,0x03,0x06,0xCC,0xE0,0xF0,0xF8,0xFC,0x06,0x03,0x01,0x03,0x06,0x0C,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0xB6,0x00,0x00,0xE0,0xF8,0x38,0x1C,0x1C,0x1C,0x3C,0x78,0xF0,0xC0,0x00,0x00,0x7C,0xFC,0xC0,0x00,0x00,0x00,0x00,0x00,0xF1,0xFF,0x1F,0x7C,0xE0,0x00,0x00,0x00,0x30,0x38,0x1C,0x8C,0xCC,0xF8,0xF0,0x00,0x00,0x78,0xFC,0x0C,0x0C,0x00,0x78,0xFC,0xCC,0x8C,0x98,0xFC,0xFC,0x00,0x00,0x3C,0xFC,0xC0,0x00,0x7C,0xFC,0xC0,0x00,0x00,0xF0,0xF8,0x1C,0x0C,0x0C,0x1C,0x38,0xF0,0xC0,0x00,0x7C,0xFC,0xC0,0x00,0x00,0x00,0x3C,0xFC,0xC0,0x00,0x78,0xFC,0x0C,0x0C,0x00,0x1C,0x3C,0x7C,0xCC,0x8C,0x0C,0x0C,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x00,0x00,0x1F,0x7F,0xF0,0xC0,0x80,0x80,0x80,0x80,0xC0,0xF0,0x30,0x00,0x00,0x3F,0x3F,0x0C,0x18,0x38,0x20,0x00,0x3F,0x3F,0x00,0x00,0x03,0x1F,0x3C,0x20,0x00,0x0F,0x1F,0x33,0x31,0x31,0x38,0x18,0x00,0x30,0x3F,0xFC,0xB0,0x30,0x00,0x0C,0x1C,0x31,0x31,0x31,0x3F,0x1F,0x00,0x00,0x7F,0xFF,0x80,0x30,0x7F,0xFF,0xB0,0x30,0x07,0x0F,0x1C,0x38,0x30,0x30,0x38,0x1F,0x07,0x00,0x00,0x3F,0x3F,0x0C,0x10,0x30,0x30,0x3F,0x1F,0x00,0x30,0x3F,0xFC,0xB0,0x30,0x00,0x30,0x30,0x31,0x33,0x3E,0x3C,0x38,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x30,0x60,0xC0,0x80,0xC0,0x60,0x33,0x07,0x0F,0x1F,0x3F,0x60,0xC0,0x80,0xC0,0x60,0x30,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x01,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};
void show_bitmap(unsigned char bitmap)
{
unsigned char j=0;
unsigned char i=0;
WriteCommand(0x00); //lower column address
WriteCommand(0x10); //upper column address
WriteCommand(0xB0); //set page address
for(i=0;i<8;i++)
{
WriteCommand(0x00); //lower column address
WriteCommand(0x10); //upper column address
WriteCommand(0xB0+i); //set page address
for(j=0;j<128;j++)
{
if(bitmap==0)
{
WriteData(boot_logo[i][j]);
}
}
}
}
void main()
{
setup_spi(SPI_MASTER|SPI_SS_DISABLED |SPI_XMIT_L_TO_H|SPI_SAMPLE_AT_END);
OUTPUT_HIGH(RES);
init_OLED();
//reset_display();
show_bitmap(0); // display boot logo
delay_ms(1000);
while(TRUE)
{
}
}

Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.