I am trying to use OLED display in a dspic33f microchip. I've successfully initialized and sent data using I2C to OLED. I managed to display a small font(8pt) on the OLED. However, when I tried a bigger font, part of the font is being obstructed(can't show the whole part of that font).
The code is as the following.
static unsigned char buffer[1024 ] = {
// @18 '2' (5 pixels wide) //generated by using The Dot Factory
0xC0, 0x80, // ## #
0xA0, 0x80, // # # #
0x90, 0x80, // # # #
0x8D, 0x80, // # ## ##
0x87, 0x00, // # ###
// @9 '2' (4 pixels wide)
0x00,
0xC1, // ## #
0xA1, // # # #
0x91, // # # #
0x8E, // # ###
0x00
};
void Oled_init(void){
command(0xAE); //display off
command(0xD5); //display clk div
command(0x80); //ratio -- continuation of clk_div
command(0xA8); //mux ratio
command(0x3F);
command(0xD3); //display offset
command(0x0); //no offset- continuation of display_offset
command(0x40 | 0x00); //display starting line
command(0x8D); //charge pump
command(0x14); //internal vcc
command(0x20); //memory mode
command(0x00);
command(0xA1); //remap columns
command(0xC8); //remap rows
command(0xDA); //com pins
command(0x12);
command(0x81); //set contrast
command(0xCF);
command(0xDB); //set Vcomh
command(0x40);
command(0xD9); //pre charge
command(0xF1);
command(0xA4); //entire display on
command(0xA6); //normal display
command(0x2E);
command(0xAF); //display on
}
void display (void){
command(0x21); //column start address
command(0);
command(0x7F);
command(0x22); //set page address
command(0x00); //min
command(0x07); //max //128x64resolution
unsigned int i = 0;
unsigned char x = 0;
for(i = 0; i < 1023; i++){
OpenI2C2(I2CConfig2, I2C2_BRG);
IdleI2C2 ();
StartI2C2 ();
while(I2C2CONbits.SEN);
MasterWriteI2C2(0x78);
MasterWriteI2C2(0x40); //Co = 0, D/C = 1, last 6 bit = 0
for (x = 0; x < 16; x++){
MasterWriteI2C2(buffer[i]);
i++;
}
i--;
StopI2C2 ();
while(I2C2CONbits.PEN);
CloseI2C2();
}
}
This problem has been troubling me since the last few weeks and I still couldn't find any solution to it. Thanks for any solution in advance.