- This topic has 31 replies, 3 voices, and was last updated 13 years, 7 months ago by gana.
-
AuthorPosts
-
April 13, 2011 at 5:18 am #5956ganaParticipant
hi it is gana i have problem with Micro C here i have a error message ” Not enough RAM ‘? lstr 10_lcd” bolded one is name of the project i am using at89c52 help ??
AND CODE : i am just beginner you know kk what is the ”char txt[100];” can i delete it what does it’s role?
char txt[100];
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 “);
}
} }April 13, 2011 at 5:30 am #5958romel emperadoParticipanti dont know what is the function of that array in your code but base in your code posted above that declaration has no use and you can delete that..
pls start a simple display program before you complicate things in your code.
just display “test: in the LCD before adding complicated things in the code .
April 13, 2011 at 5:34 am #5959ganaParticipantofcourse i did it works. but after i added some else if function then not enough RAM error appears. it is just easy way to display if input becomes high.
April 13, 2011 at 5:41 am #5960romel emperadoParticipantare you using full version of mikkroC? is that your complete source code?
April 13, 2011 at 5:43 am #5961ganaParticipanti do not know is it full? this is entire code kk
April 13, 2011 at 5:50 am #5962romel emperadoParticipanti dont understan you
you spend time making this project then now you dont know if it is full.. lol
April 13, 2011 at 5:57 am #5963ganaParticipantkk the program that i got from my friend i didnt ask from him. now he is not here kk so how can i find full it maybe sells right? do you have it? the give it for free kk
April 13, 2011 at 6:17 am #5964romel emperadoParticipantby the way what you are trying to do with your program?
April 13, 2011 at 7:07 am #5966ganaParticipanttrying to display with 2 line kk first time i told you i tryed to display using second line and it doesnt work. but now this code is so easy to display and first code is used 11pins of controller, but this guy using 7 pins ..by the way the code i sent today is works if i delete half of them like that :
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 “);}}
} }but i need all codes of them to display nicely kk
April 13, 2011 at 7:53 am #5968romel emperadoParticipantso whats the problem of that code above? if you can display to 1st and 2nd line so what is the probem?
the code fo mikroC is working fine I used that many times…
you cannot have complete code you want because no one knows what you want.. from that example code of mikroC modify that and make accroding to your application..
April 13, 2011 at 8:04 am #5969ganaParticipantok 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 “);
}
} }April 13, 2011 at 8:13 am #5970romel emperadoParticipantim very busy gana i cannot check each line of your code..
do it step by step so that you will know where is the problem… what is the size of your code? at89c51 has only 4kb of ram
April 19, 2011 at 8:55 am #5997ganaParticipanthi i have a question about proteus7… we know if some pin of chip has high value it showes red color and low voltage is blue color ….But sometimes it showes yellow and gray colors and takes error what does this mean?
April 20, 2011 at 4:50 am #6007romel emperadoParticipantwhen it grays it means the one end has low and the other is high….
April 29, 2011 at 5:08 pm #6060ganaParticipantyour HEX of key password has written in keil right ? but in my chip burning mashine can not get it and burn..
but if i change it on MicroC it can but doesnt work. so in below we have a changed Code that i changed and can you check it and make it correct into MicroC … i need your password code of Home security project in MicroC pls help and cjeck this out..
#define display P3
#define KEYPAD P1sbit doorclose at P1_7_bit;
sbit correct at P3_5_bit;
sbit wrong at P3_4_bit;
sbit key at P3_7_bit;
void DelayMs(unsigned int);
void save (unsigned char);
void compare (void);
void next (void);sbit neg at P1_4_bit;
sbit xor at P1_5_bit;
sbit gur at P1_6_bit;unsigned char keypad[4][3]= { ‘1’, ‘2’, ‘3’,
‘4’, ‘5’, ‘6’,
‘7’, ‘8’, ‘9’,
‘*’, ‘0’, ‘#’};unsigned char displayb[4][3]= { 1 , 2 , 3 ,
4 , 5 , 6 ,
7 , 8 , 9 ,
0, 0 , 0};unsigned char code password[6]= “12345”;
unsigned char user[30]; //user is allowed to press 30 keys without entering
unsigned char q,a=0,z=0;
char t=1;
bit tr;
char d;void main(void)
{
unsigned char colloc,rowloc;
doorclose=0;
KEYPAD=1;
while(1)
{
neg=1; xor=1; gur=1;
do
{
KEYPAD=0xF0;
colloc=((KEYPAD)&&( 0xF0));
}
while(colloc ==0xF0); // if any key pressed
DelayMs(1); // some delay
do
{
colloc=KEYPAD;
colloc =0xF0; //zassan
}while(colloc==0xF0); // to verify is really key pressedKEYPAD=0xFE;
colloc=((KEYPAD)&&(0xF0));
if(colloc !=0xF0)
{
rowloc=0;
goto next;
}KEYPAD=0xFD;
colloc=((KEYPAD)&&(0xF0));
if(colloc !=0xF0)
{
rowloc=1;
goto next;
}
KEYPAD=0xFB;
colloc=((KEYPAD)&&(0xF0));
if(colloc !=0xF0)
{
rowloc=2;
goto next;
}KEYPAD=0xF7;
colloc=((KEYPAD)&&(0xF0));
{rowloc=3;
goto next ; }next:
if (colloc==0xE0)
{
key=0; // verifying that key is pressed
DelayMs(145);
key=1;
display=(((display )&& (0xf0))||(displayb[rowloc][0])); // display to 7 seg
save(keypad[rowloc][0]);
}
else if(colloc==0xD0)
{
key=0; // verifying that key is pressed
DelayMs(145);
key=1;
display=(((display )&& (0xf0)) || (displayb[rowloc][1]));
save(keypad[rowloc][1]);
}
else if(colloc==0xb0)
{
key=0; // verifying that key is pressed
DelayMs(145);
key=1;
display=(((display & 0xf0)) || ((displayb[rowloc][2])));
save(keypad[rowloc][2]);
}
DelayMs(100); // here this delay is important if this is less than 100ms then
// controller understand 1 key as press 2 or 3 times becoz that
//is fast as compaer o our pressing if u want to remove delay from here
// then increse the above 1ms to 100 ms
}
}void save (unsigned char c)
{
if(c==’*’)
{
if(a!=0)
a–;
return;
}if((a==5) && (c==’#’))
{
a=0;
compare();if(t==1)
{
if(tr==1) // if match ok
{
DelayMs(40);
correct=0;
t=2;
for(d=0; d<7; d++) // on and after 10 sec off nw keypad can’t get data
DelayMs(50); // max delay u can get is DelayMs(65535) otherwise need looping for big delay
correct=1;
z=0;
a=0; // start agian from 0 location of array}
else if(tr==0)
goto error;}
else if(t==2)
{
DelayMs(40);
doorclose=0;
t=1;
for(d=0; d<5; d++)
DelayMs(50);
doorclose=1;
}
}else if((a>5 && c==’#’) || (a<5 && c==’#’))
{
error:
for(q=0; q<5; q++)
{
wrong=0;
DelayMs(220);
wrong=1;
DelayMs(220);
a=0;
}
z=z+1;if(z==4)
{
for(q=0; q<10; q++)
{
wrong=0;
DelayMs(2000);
wrong=1;
z=0;
DelayMs(220);
}
}
a=0;
}
else
{
user[a]=c;
a++;if(a==30) // if the user press 31 keys without entering it will automatically indicate an error
{
display=((display & 0xf0) || (displayb[3][1])); //brings a zero display on the seven segment
goto error; //redirect to error code
}
}} //end of save
void compare (void)
{
unsigned char b;
for(b=0;b<5;b++)
{if(user==password)
tr=1;
else
{
tr=0;
break;
}
}
}//
// Delay mS function
//
void DelayMs(unsigned int count)
{ // mSec Delay 11.0592 Mhz
unsigned int i;
while(count) {
i = 115;
while(i>0) i–;
count–;
}
} -
AuthorPosts
- You must be logged in to reply to this topic.