hemnath
Advanced Member level 3
![Advanced Member level 3](/styles/images/ranks/glevel3.gif)
Hi all,
I am interfacing graphic LCD EA DOGM128X-6 which uses ST 7565R controller with pic 18F2520. Crystal freq: 4Mhz internal.
Double checked the hardware. Connections are correct. Power used for microcontroller and glcd display is +3.3V DC.
Below is the sample code to on the pixels on glcd:
But there is nothing on display. Please help.
I am interfacing graphic LCD EA DOGM128X-6 which uses ST 7565R controller with pic 18F2520. Crystal freq: 4Mhz internal.
Double checked the hardware. Connections are correct. Power used for microcontroller and glcd display is +3.3V DC.
Below is the sample code to on the pixels on glcd:
Code:
#include "18F2520.h"
#fuses INTRC_IO
#use delay(clock=4000000)
// definitions
#define GLCD_CS1 PIN_A1
#define GLCD_RESET PIN_A2
#define GLCD_A0 PIN_A0
#define GLCD_SCL PIN_C3
#define GLCD_SDA PIN_C4
void glcd_command(unsigned char command);
void glcd_data(unsigned char data);
void main()
{
int i;
output_low(GLCD_CS1);
output_low(GLCD_RESET);
delay_ms(200);
output_high(GLCD_RESET);
delay_ms(10);
glcd_command(0x40); // initialization
glcd_command(0xA1);
glcd_command(0xC0);
glcd_command(0xA6);
glcd_command(0xA2);
glcd_command(0x2F);
glcd_command(0xF8);
glcd_command(0x00);
glcd_command(0x27);
glcd_command(0x81);
glcd_command(0x16);
glcd_command(0xAC);
glcd_command(0x00);
glcd_command(0xAF);
while(1)
{
i = 0;
for(i = 0; i < 63; i++)
{
glcd_command(0x00+i);
glcd_data(0xff);
delay_ms(100);
}
}
}
void glcd_command(unsigned int8 command)
{
int n;
output_low(GLCD_A0);
output_low(GLCD_CS1);
for (n = 0; n < 8; n++)
{
if (command & 0x80)
{
output_high(GLCD_SDA);
}
else
{
output_low(GLCD_SDA);
}
// Pulse SCL
output_high(GLCD_SCL);
delay_ms(10);
output_low(GLCD_SCL);
command <<= 1;
}
output_high(GLCD_CS1);
}
void glcd_data(unsigned int8 data)
{
int n;
output_high(GLCD_A0);
output_low(GLCD_CS1);
for (n = 0; n < 8; n++)
{
if (data & 0x80)
{
output_high(GLCD_SDA);
}
else
{
output_low(GLCD_SDA);
}
// Pulse SCL
output_high(GLCD_SCL);
delay_ms(10);
output_low(GLCD_SCL);
data <<= 1;
}
// Unselect the chip
output_high(GLCD_CS1);
}
But there is nothing on display. Please help.