Forum Replies Created
-
AuthorPosts
-
ganaParticipant
it doesnt work, no output value from P1 … and your hex file that you uploaded in your website it doesnt upload in to my chip burning mashine maybe its because of mashine but i can not find other mashine can you give me the code that you changed in MicroC?
ganaParticipantyour 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–;
}
}ganaParticipanthi 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?
ganaParticipantok 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 “);
}
} }ganaParticipanttrying 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
ganaParticipantkk 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
ganaParticipanti do not know is it full? this is entire code kk
ganaParticipantofcourse 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.
ganaParticipanthi 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 “);
}
} }ganaParticipantkk i almost new that i have changed your project …added LCD and sensors with WIRELESS but i want to make the that code diffrent..like a…in this code we have password only 12345 but i wonna change it whenever i want, like holding (#,*) keys and then restore it what password i wanted . can you help me wth the code ?
ganaParticipantit is from your site the guy who made project of home security gave it to me but the name is looks like your name!!!kkk
ganaParticipanthi can can you guys convert this code to MicroC? i am learnin Micro C but i can not convert it with my mind pls teach me the way how to changeit…
#include <REG51.h>
#define display P3
#define KEYPAD P1sbit doorclose = P1^7;
sbit correct = P3^5;
sbit wrong= P3^4;
sbit key = P3^7;
void DelayMs(unsigned int);
void save (unsigned char);
void compare (void);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[5]= “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 true;
char d;void main(void)
{
unsigned char colloc,rowloc;while(1)
{
do
{
KEYPAD=0xF0;
colloc=KEYPAD & 0xF0;
}
while(colloc ==0xF0); // if any key pressed
DelayMs(1); // some delay
do
{
colloc=KEYPAD;
colloc &=0xF0;
}while(colloc==0xF0); // to verify is really key pressed
KEYPAD=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(true==1) // if match ok
{
DelayMs(800);
correct=0;
t=2;
for(d=0; d<7; d++) // on and after 10 sec off nw keypad can’t get data
DelayMs(1000); // 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(true==0)
goto error;}
else if(t==2)
{
DelayMs(800);
doorclose=0;
t=1;
for(d=0; d<5; d++)
DelayMs(1000);
doorclose=1;
}
}
else if((a>5 && c==’#’) || (a<5 && c==’#’))
{
error:
for(q=0; q<5; q++)
{
wrong=0;
DelayMs(420);
wrong=1;
DelayMs(420);
a=0;
}
z=z+1;if(z==4)
{
for(q=0; q<10; q++)
{
wrong=0;
DelayMs(20000);
wrong=1;
z=0;
DelayMs(420);
}
}
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 savevoid compare (void)
{
unsigned char b;
for(b=0;b<5;b++)
{if(user==password)
true=1;
else
{
true=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–;
}
}ganaParticipanthi guys i have almost done but the problem is i can not move the cursor to the second line . i wonna write on second line but i cant.in the lecture C0 Hex move cursor into second line but it doesnt how cani ? help?
ganaParticipanthi there thank you a lot i check it out ..but it is not working on my project can you send me your project picture pls? and i tryed the examlpes from MicroC but every code i tryed that not working . when i compile it i having error . i think something is missing in the code written below:
// Lcd module connections
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
char txt1[] = "mikroElektronika";
char txt2[] = "Easy8051B";
char txt3[] = "Lcd4bit";
char txt4[] = "example";
char i; // Loop variable
void Move_Delay() { // Function used for text moving
Delay_ms(500); // You can change the moving speed here
}
void main(){
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,6,txt3); // Write text in first row
Lcd_Out(2,6,txt4); // Write text in second row
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,txt1); // Write text in first row
Lcd_Out(2,5,txt2); // Write text in second row
Delay_ms(2000);
// Moving text
for(i=0; i<4; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
while(1) { // Endless loop
for(i=0; i<8; i++) { // Move text to the left 7 times
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}
for(i=0; i<8; i++) { // Move text to the right 7 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
}
}
-
AuthorPosts