Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Server-Based Coded Door Locking system using PIC16F788a

Status
Not open for further replies.

reaver26

New Member
hello to all, i just want to ask anyone who have in-depth knowledge about microcontroller specifically using pic16f877a

im thinking about certain features:

1. MCU interface to a server unit with database to monitor the login/logout of user's on the room to be implemented.

2. 6 digit PIN CODE will be entered to a numeric keypad and retrieved the user's information from the server unit and lock/unlock the door via MCU.

3. the server will be able to monitor the time of login and logout of the user on the prticular room but entering the 6digit pin code on the numeric keypad before entering and before closing the door

4. the system will have an alarm in a form of a buzzer prior to the end of room usage stated on the server.

my question is that:

are my goals attainable? namely retrieving data thru MCU going to the server ?

this will be the flow:

keypad==>MCU==>server (if true) ==>back to MCU ==> door lock/unlock
server (if false) ==> back to MCU ==> keypad Access denied

hope someone would reply on this..
 

reaver26

New Member
update on this thread: we are able to transmit data between MCU(pic16f877a) and Desktop Computer via D9 cable

toolsuite compiler: Hi-tech C compiler
program compiler/debuuger : MPLAB IDE

problems: how can i get the LED to lit when there's an element inside an array?

scenario on KEYPRESS:
upon pressing 1st KEY 1st led will light ON, pressing 2nd KEY 2nd led will light On......

scenario on INPUT CLEARING:
clearing DATA as a whole for example.. the keypad was pressed twice which was not done by the user, it must be clear before entering his 6 digit key using "asterisk key". and "#" serve as ENTER

im using a 3x4 keypad

1 2 3
4 5 6
7 8 9
* 0 #

can anyone help? my current code is this:


#include <pic.h>

//configuration fuses
__CONFIG(HS & WDTDIS & PWRTDIS & UNPROTECT);

unsigned char scanned_key = 0x00;
unsigned char decoded_key = 0x00;

void init_LED(void)
{
PORTB &= ~0x0F;
TRISB &= ~0x0F;
}

void init_KEYPAD(void)
{
TRISD |= 0x70; //PORTD<6:4> input, COLUMNS
TRISD &= ~0x0F; //PORTD<3:0> output, ROWS
PORTD |= 0x0F; //PORTD<3:0> initially high
}

unsigned char decode_key(unsigned char val)
{
unsigned char key;

switch(val)
{
case 0x60: //1
//key = 0x01;
break;
case 0x50: //2
//key = 0x02;
break;
case 0x30: //3
//key = 0x03;
break;
case 0x61: //4
//key = 0x04;
break;
case 0x51: //5
//key = 0x05;
break;
case 0x31: //6
//key = 0x06;
break;
case 0x62: //7
//key = 0x07;
break;
case 0x52: //8
//key = 0x08;
break;
case 0x32: //9
//key = 0x09;
break;
case 0x63: //*
//key = 0x00;
break;
case 0x53: //0
//key = 0x0B;
break;
case 0x33: //#
//key = 0x0C;
break;
default:
//key = decoded_key;
break;
}

return key;
}


void display_key(unsigned char key)
{
PORTB = key;
}


unsigned char scan_keypad()
{
unsigned char val_1 = 0x00;
unsigned char val_2 = 0x00;
unsigned char count1;

for(count1=0;count1 < 4;count1++)
{
PORTD = ~(0x01 << count1); //scan row
val_1 = PORTD & 0x70; //read column, RD<6:4>
//while clearing RD<7> &
//RD<3:0>
if (val_1 != 0x70) //if a column is pressed
{
val_2 = (val_1 | count1); //column (high-nibble) and count (low-nibble)
return val_2; //return value
}
}

return 0xFF; //return any value
}


void main()
{
init_LED(); //initialize PORTB<3:0>, 4 LEDS connected
init_KEYPAD(); //initialize PORTD;
//PORTD<3:0> as output
//PORTD<6:4> as input

while(1)
{
scanned_key = scan_keypad();
decoded_key = decode_key(scanned_key);
display_key(decoded_key);
}
}

///
/*
1 0x60
2 0x50
3 0x30
4 0x61
5 0x51
6 0x31
7 0x62
8 0x52
9 0x32
asterisk 0x63
0 0x53
hash 0x33
*/


for now all it do was everytime i press the key. its corresponding hex value will lit the LED. and another problem... i cant seems to get the HEX value of 8. the 4th led doesnt light ON. and goes to other combination


thank you...
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top