Projects › Projects › About LCD 2×16 › ok check this out : first
ok check this out : first code is fine but second code is not working and shows error like ( not enough RAM ) that is it. but first and second are same , i just added few else if command and others into first code not much so that s second code kk. now iwe have first and second codes below check and help me what is wrong..
1)
char keypadPort at P0;
sbit input4 at P1_4_bit;
sbit input3 at P2_7_bit;
sbit input2 at P2_6_bit;
sbit input1 at P1_3_bit;
sbit LCD_RS at P2_0_bit;
sbit LCD_EN at P2_1_bit;
sbit LCD_D4 at P2_2_bit;
sbit LCD_D5 at P2_3_bit;
sbit LCD_D6 at P2_4_bit;
sbit LCD_D7 at P2_5_bit;
// End Lcd module connections
void main() {
P1=0;
input2=0;
input3=0;
// Initialize Keypad
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1, 1, ” bvx yum “); // Write message text on Lcd
Lcd_Out(2, 1, ” ok bna “);
while (1){
if((input1==1)&&(input2==0) &&(input3==0)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “gal”); }
else if ((input1==0)&&(input2==1) &&(input3==0)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “xaalga “);}
}
} }
2)
char keypadPort at P0;
sbit input4 at P1_4_bit;
sbit input3 at P2_7_bit;
sbit input2 at P2_6_bit;
sbit input1 at P1_3_bit;
sbit LCD_RS at P2_0_bit;
sbit LCD_EN at P2_1_bit;
sbit LCD_D4 at P2_2_bit;
sbit LCD_D5 at P2_3_bit;
sbit LCD_D6 at P2_4_bit;
sbit LCD_D7 at P2_5_bit;
// End Lcd module connections
void main() {
P1=0;
input2=0;
input3=0;
// Initialize Keypad
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1, 1, ” bvx yum “); // Write message text on Lcd
Lcd_Out(2, 1, ” ok bna “);
while (1){
if((input1==1)&&(input2==0) &&(input3==0)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “gal”); }
else if ((input1==0)&&(input2==1) &&(input3==0)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “xaalga “);}
else if ((input1==0)&&(input2==0) &&(input3==1)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “tsonx “);}
else if ((input1==0)&&(input2==0) &&(input3==0)&&(input4==1))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “xodolgoon”);}
else if((input1==1)&&(input2==1)&&(input3==0)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “gal”);
Lcd_Out(2, 1, “xaalga “);}
else if((input1==1)&&(input2==0)&&(input3==1)&&(input4==0))
{ Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “gal”);
Lcd_Out(2, 1, “tsonx “);
}
else if((input1==1)&&(input2==0)&&(input3==0)&&(input4==1))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “gal”);
Lcd_Out(2, 1, “xodolgoon “);}
else if((input1==0)&&(input2==1)&&(input3==1)&&(input4==0))
{Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “tsonx “);
Lcd_Out(2, 1, “xaalga “);}
else if((input1==0)&&(input2==1)&&(input3==0)&&(input4==1))
{ Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “xodolgoon “);
Lcd_Out(2, 1, “xaalga “);}
else if((input1==0)&&(input2==0)&&(input3==1)&&(input4==1))
{ Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, “xodolgoon “);
Lcd_Out(2, 1, “tsonx “);
}
} }