64128cog lcd,, check my code please
Hello everyone;
I am trying to run 64128COD LCD using PIC18F2455. The hardware is just what the datasheet says, except I am using ceramic capacitors while the datasheet has electrolytic ones,, I don’t think that would make any different as far as values are the same.
I have read the datasheet for the LCD driver and made the software carefully, but, didn’t work!! I tried to modify the code based on some suggestions that I read over the net and it didn’t work.
Below is my C code, and there is a part of the schematic.. Any advice would be appreciated.
Hello everyone;
I am trying to run 64128COD LCD using PIC18F2455. The hardware is just what the datasheet says, except I am using ceramic capacitors while the datasheet has electrolytic ones,, I don’t think that would make any different as far as values are the same.
I have read the datasheet for the LCD driver and made the software carefully, but, didn’t work!! I tried to modify the code based on some suggestions that I read over the net and it didn’t work.
Below is my C code, and there is a part of the schematic.. Any advice would be appreciated.
Code:
//LCD ports
#define SID LATBbits.LATB4
#define SCLK LATBbits.LATB3
#define RS LATBbits.LATB2
#define RST LATBbits.LATB1
#define CS1B LATBbits.LATB0
void main(void)
{
// LATB = 0x00;
TRISB = 0b00000000; //all outputs
// Initialise LCD:
RST = 0; //Reset is Low
Delay1KTCYx(10);
RST = 1; //Reset is High
CS1B = 0; // enable chip
Delay1KTCYx(3);
RS = 0; // control command
parallelToSerial(resetLCD);
LCDinit();
while(1){
LCDwriteData();
}
}
void LCDinit(void)
{
RS = 0; // control command
parallelToSerial(0XA0);// SEG 132, ADC 0
parallelToSerial(0XC0); // com direction com_1 64
parallelToSerial(0XA2);// select LCD biase
parallelToSerial(0X2F);// voltage converter,regulator, follower are all on
Delay1KTCYx(10); // delay >1ms
parallelToSerial(0X26);// regulator resistor
parallelToSerial(0X81);// refernce voltage1 (default)
parallelToSerial(0X25);// refernce voltage2 (control contrast)
Delay1KTCYx(250); // delay > Stabilizing the LCD
}
void LCDwriteData(void)
{
RS = 0; // control command
parallelToSerial(InitDisLine);
parallelToSerial(InitPagAdd);
parallelToSerial(InitColAddH);
parallelToSerial(InitColAddL);
RS = 1; // Data command
parallelToSerial(0XFF);// any data
RS = 0; // control command
parallelToSerial(0XAF);// Turn LCD On
}
void parallelToSerial(unsigned char data)
{
CS1B = 0; // enable chip
SID = data&0b00000001;
SCLK = 0;
SCLK = 1;
SID = data&0b00000010;
SCLK = 0;
SCLK = 1;
SID = data&0b00000100;
SCLK = 0;
SCLK = 1;
SID = data&0b00001000;
SCLK = 0;
SCLK = 1;
SID = data&0b00010000;
SCLK = 0;
SCLK = 1;
SID = data&0b00100000;
SCLK = 0;
SCLK = 1;
SID = data&0b01000000;
SCLK = 0;
SCLK = 1;
SID = data&0b10000000;
SCLK = 0;
SCLK = 1;
Delay10TCYx(50);
CS1B = 1; // disable chip
}
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Last edited: