jean12
Advanced Member level 2
Hello,could you please help me to know why my LCD is not getting initialized?
I am using microc v6.6.3 but the LCD is only showing the first line of black squares nothing else,when adjusting the potentiomter for brightness nothing changes about characters only the black squares disappear .
Could you please help me to detect this problem?
Here are my codes:
Kind Regards,
I am using microc v6.6.3 but the LCD is only showing the first line of black squares nothing else,when adjusting the potentiomter for brightness nothing changes about characters only the black squares disappear .
Could you please help me to detect this problem?
Here are my codes:
PHP:
unsigned char ch;
unsigned max_point0 = 0;
unsigned int i,tlong0,tlong1;
char *volt="00.0";
//char *current="0.00";
unsigned int a;
// LCD module connections
sbit LCD_RS at RC2_bit;
sbit LCD_EN at RC3_bit;
sbit LCD_D4 at RC4_bit;
sbit LCD_D5 at RC5_bit;
sbit LCD_D6 at RC6_bit;
sbit LCD_D7 at RC7_bit;
sbit LCD_RS_Direction at TRISC2_bit;
sbit LCD_EN_Direction at TRISC3_bit;
sbit LCD_D4_Direction at TRISC4_bit;
sbit LCD_D5_Direction at TRISC5_bit;
sbit LCD_D6_Direction at TRISC6_bit;
sbit LCD_D7_Direction at TRISC7_bit;
char look(int a)
{
switch(a)
{
case 0:
return '0';
case 1:
return '1';
case 2:
return '2';
case 3:
return '3';
case 4:
return '4';
case 5:
return '5';
case 6:
return '6';
case 7:
return '7';
case 8:
return '8';
case 9:
return '9';
default:
return '.';
}
}
void main()
{
PORTC=0;
TRISC=0x00;
LCD_init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
Lcd_out(2,1,"DVM Project");
delay_ms(1500);
}
}
/*TRISA = 0b00011111;
TRISC = 0x00;
TRISD=0X00;
PORTD=0;
PORTC=0;
ADCON1=0x00;
OPTION_REG = 0b00101000;
delay_us(50);
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_us(20);
while(1)
{
PORTD.B0=1;
PORTD.B1=0;
delay_ms(1000);
PORTD.B1=1;
PORTD.B0=0;
delay_ms(1000);
v=ADC_read(3);
i=(i*4.89)/0.2;
v=((v*4.89)/20)*120; //use of R1=100K and R2=20K
if(v!=vp||i!=ip)
vp=v;
volt[0] = look(v/10000);
volt[1] = look((v/1000)%10);
volt[3] = look((v/100)%10);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1, "DVM Project");
delay_ms(1500);
Lcd_Out(1,1,"DC=");
Lcd_Out(1,11,volt);
Lcd_Out(1,15,"V");
Delay_ms(2000);
/* Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1, "Battery Charger");
Lcd_out(2,2, "IPRC SOUTH"); */
// delay_ms(2000); */
Kind Regards,