EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / your HEX of key password has

your HEX of key password has

|

Projects › Projects › About LCD 2×16 › your HEX of key password has

April 29, 2011 at 5:08 pm #6060
gana
Participant

your 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 P1

sbit 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 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(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–;
    }
}

RSS Recent Posts

  • Voltage comparator circuit verification May 10, 2026
  • What is this??? May 10, 2026
  • Why aren’t the power windows in my 2006 Volkswagen Polo 2006 working despite repairing the control unit circuit board? May 10, 2026
  • infiniBand Layer 1 specifications testing question May 8, 2026
  • block RF May 8, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise