Programmable number lock system is a high security number lock system that can be used to lock electronic devices. The present system is very user friendly. This system is a combination of software and hardware at its best. We have used a 8051 microcontroller kit for interfacing our system.
In the present design we can activate or deactivate 9 devices. Each device is locked using a 4 digit code (password). The code can be set as per the user’s desire, hence the name ‘ PROGRAMMABLE ‘. For the device to be activated (unlocked), the user should enter the code that had been entered when the device was locked. In case the user enters the wrong code a silent alarm will be activated.
In the present design we can activate or deactivate 9 devices. Each device is locked using a 4 digit code (password). The code can be set as per the user’s desire, hence the name ‘ PROGRAMMABLE ‘. For the device to be activated (unlocked), the user should enter the code that had been entered when the device was locked. In case the user enters the wrong code a silent alarm will be activated.
Introduction to Programmable number lock system:
The system has three units, namely:
- Keyboard unit.
- Display unit.
- Control unit.
The keyboard unit consists of 9 number keys, 1 unlock key and 1 lock key. These are all push button switches. This unit is used to select the desired device and to enter the codes into the system. It is also used to request the system to lock/unlock the selected device.
The display section contains 5 seven segment display. This unit displays the device number and the code entered. This section is detachable. If detached it does not affect the working of the whole system. This unit also contains password reset button and an LED to indicate the error when the device is already locked and user wants to lock the device again. The error indicator also indicates an error when the system is already unlocked and the user tries to unlock the same.
The control unit is the heart of our system. It contains the necessary circuitry for the control of the device .This unit controls 9 devices, which is lock/unlock by selecting it using the keyboard and entering the password. If the code entered to unlock the device is wrong, then a silent alarm is triggered .The keyboard unit and the display unit are connected to this unit.
All these three units are merged together to form the whole system.
Block diagram of Programmable number lock system:
Working of the system:
When the system is initially installed the reset button is pressed. This key is present in the control unit. This unlocks all the devices. This is to avoid undesired functioning of the system.
To lock a particular device the device number is selected using the keyboard. Once the device is selected the user has to press the lock key present in the keyboard. Now the device waits for the user to enter the the code. The user can enter a 4 digit number using the keyboard as per his desire. Once all the 4 digits are entered the system electronically locks the selected device.In the same manner to unlock a particular device, the device number is entered using the keyboard. Once the device number is selected the code for the selected device is entered. If the entered code matches the code that had been entered while that particular device was locked then the selected device will be activated (unlocked). If the codes do not match each other a silent alarm will be triggered (a LED placed in the control section. Shown in figure 3).An error indicator (placed in the display section) is provided if any user tries to lock a device which has already been locked or vice versa.
If the user is half way entering the code or has done an error while entering the code and wants to start over all again then a reset button is provided in the display section. By pressing this button the user can start from entering the device number and so on.
The number of devices which the system can control can be increased by addition of a few components in the control unit. More security can be achieved by increasing the number of digits in the code. This can be done by minor changes in the program. The system uses the internal RAM of the 8051 to store the code and hence puts a lower limit to the number of digits in the code and also the number of devices the system can control. Once the system is installed only the display unit and keyboard unit will be accessible to the user. Access to the control unit should be provided only to an official personal since it contains the system reset button.
System:
In this section we will be explaining the hardware design these units individually. Each unit description is accompanied by its circuit diagram.
KEYBOARD UNIT :
The keyboard used in this system is an encoder type. It uses IC 74147 priority encoder to convert the entered the digits to its corresponding binary codes. IC 74147 has a active low inputs as well as active low outputs (for more details please refer the corresponding data sheets). Each of the pins are activated using push to on switches. These switches ground the encoder inputs to activate that particular number giving the equivalent BCD code. This is then given as input to IC 7404 which is an inverter. To avoid loading of 7404 by the later stages transistor switches are provided to each of its outputs. The circuit diagram of the keyboard is as given in the next section.
DISPLAY UNIT :
The logic used here is shift and display i.e. when the next number is entered the previous number is shifted to the left by one unit and then the next number is displayed. To achieve this we have used IC 7496 which is a 5–bit shift register (for more details please refer the corresponding data sheets). The data lines from control section are given serially to the registers as shown in the circuit. The clock to these registers is given by the program every time a button on the keyboard is pressed. The shifting used here is parallel shifting. The outputs of the registers are given to CD4511 BCD to seven segment decoder. The seven segment display used are common cathode type since the output of the decoder is high when activated. This section consists of a reset switch which is used to reset the display.
Control unit:
The program codes for this project is given in the next page
APPLICATION:
The ‘Electronic device number lock’ system is a high security system.The main application kept in mind during the design of this system is to secure expensive electronic devices and machinery. The access to such devices can be restricted to particular users only. The system is highly secured since the code can be changed every time the user locks it.
This can also be used an physical lock by using solenoid and thus can be used to lock safes in banks or other institutions.
Regular electronic number lock available in the market can lock/unlock just one device, but this design can lock/unlock up to nine devices.
The ‘Electronic device number lock’ system is a high security system.The main application kept in mind during the design of this system is to secure expensive electronic devices and machinery. The access to such devices can be restricted to particular users only. The system is highly secured since the code can be changed every time the user locks it.
This can also be used an physical lock by using solenoid and thus can be used to lock safes in banks or other institutions.
Regular electronic number lock available in the market can lock/unlock just one device, but this design can lock/unlock up to nine devices.
The program used for the operation of this system is as follows :
;***************************************************************;
PROCEDURE OF WAIT
;***************************************************************
org 8500h
wait: push dph
push dpl
push r0
push r1
mov dptr,#2042h ;input data from PORT C
wi: movx a,@dptr
mov r2,a
anl a,#20h
jz cont ;check for interrupt from display unit
jmp start
cont: mov a,r2
anl a,#0fh ;to check whether any key is pressed
jz wi
mov r0,#75
lcall 6798h
mov dptr,#2042h
here: movx a,@dptr ;wait for the key to be realesed
jnz here
mov dptr,#2040h ;sending a pulse to the display section
mov a,r2
movx @dptr,a
mov a,#00h
mov dptr,#2041h
movx @dptr,a
mov a,#40h
movx @dptr,a
mov a,r2
mov r0,#75
lcall 6798h
pop r1
pop r0
pop dpl
pop dph
ret
;***************************************************************;
PROCEDURE OF WAIT
;***************************************************************
org 8500h
wait: push dph
push dpl
push r0
push r1
mov dptr,#2042h ;input data from PORT C
wi: movx a,@dptr
mov r2,a
anl a,#20h
jz cont ;check for interrupt from display unit
jmp start
cont: mov a,r2
anl a,#0fh ;to check whether any key is pressed
jz wi
mov r0,#75
lcall 6798h
mov dptr,#2042h
here: movx a,@dptr ;wait for the key to be realesed
jnz here
mov dptr,#2040h ;sending a pulse to the display section
mov a,r2
movx @dptr,a
mov a,#00h
mov dptr,#2041h
movx @dptr,a
mov a,#40h
movx @dptr,a
mov a,r2
mov r0,#75
lcall 6798h
pop r1
pop r0
pop dpl
pop dph
ret
;***************************************************************;
STORING AND RETRIVING OF PASS WORD
;***************************************************************
org 8550h
scan: mov r0,#04h
mov dptr,#2042h
one: movx a,@dptr ;check for lock or unlock buttons
anl a,#0c0h
jz one
ret
STORING AND RETRIVING OF PASS WORD
;***************************************************************
org 8550h
scan: mov r0,#04h
mov dptr,#2042h
one: movx a,@dptr ;check for lock or unlock buttons
anl a,#0c0h
jz one
ret
lock: lcall wait ;storing of pass word in given location
mov @r1,a
inc r1
djnz r0,lock
lcall out
ret
mov @r1,a
inc r1
djnz r0,lock
lcall out
ret
unlock: clr 0ah
call wait
mov a,@r1
xrl a,r2 ;comparing the entered and the stored code
jz match
setb 0ah ;in case of mismatch set error bit
match: inc r1
djnz r0,unlock
jnb 0ah,go
mov a,#20h
push dptr
mov dptr,#2040h
movx @dptr,a
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
mov a,#00h
movx @dptr,a
pop dptr
jmp not
go: lcall out
not: ret
call wait
mov a,@r1
xrl a,r2 ;comparing the entered and the stored code
jz match
setb 0ah ;in case of mismatch set error bit
match: inc r1
djnz r0,unlock
jnb 0ah,go
mov a,#20h
push dptr
mov dptr,#2040h
movx @dptr,a
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
mov a,#00h
movx @dptr,a
pop dptr
jmp not
go: lcall out
not: ret
;***************************************************************;
TO ACCEPT THE DEVICE NUMBER
;***************************************************************
org 9000h
mov sp,#05fh
main: clr 01h ;clearing all the device flags
clr 02h
clr 03h
clr 04h
clr 05h
clr 06h
clr 07h
clr 08h
clr 09h
setb ie.7
setb ie.2
start: mov a,#89h ;C as ip,A and B as op
mov dptr,#2043h
movx @dptr,a
TO ACCEPT THE DEVICE NUMBER
;***************************************************************
org 9000h
mov sp,#05fh
main: clr 01h ;clearing all the device flags
clr 02h
clr 03h
clr 04h
clr 05h
clr 06h
clr 07h
clr 08h
clr 09h
setb ie.7
setb ie.2
start: mov a,#89h ;C as ip,A and B as op
mov dptr,#2043h
movx @dptr,a
mov r7,#05h ;clearing the display section
rss: mov dptr,#2040h
mov a,#00h
movx @dptr,a
mov a,#00h
mov dptr,#2041h
movx @dptr,a
mov a,#40h
movx @dptr,a
djnz r7,rss
lcall wait
cjne a,#01h,nxt2
jmp dev1
nxt2: cjne a,#02h,nxt3
jmp dev2
nxt3: cjne a,#03h,nxt4
jmp dev3
nxt4: cjne a,#04h,nxt5
jmp dev4
nxt5: cjne a,#05h,nxt6
jmp dev5
nxt6: cjne a,#06h,nxt7
jmp dev6
nxt7: cjne a,#07h,nxt8
jmp dev7
nxt8: cjne a,#08h,nxt9
jmp dev8
nxt9: cjne a,#09h,start
jmp dev9
rss: mov dptr,#2040h
mov a,#00h
movx @dptr,a
mov a,#00h
mov dptr,#2041h
movx @dptr,a
mov a,#40h
movx @dptr,a
djnz r7,rss
lcall wait
cjne a,#01h,nxt2
jmp dev1
nxt2: cjne a,#02h,nxt3
jmp dev2
nxt3: cjne a,#03h,nxt4
jmp dev3
nxt4: cjne a,#04h,nxt5
jmp dev4
nxt5: cjne a,#05h,nxt6
jmp dev5
nxt6: cjne a,#06h,nxt7
jmp dev6
nxt7: cjne a,#07h,nxt8
jmp dev7
nxt8: cjne a,#08h,nxt9
jmp dev8
nxt9: cjne a,#09h,start
jmp dev9
;***************************************************************;
SELECTED DEVICE ACTIVATION
;***************************************************************
org 9200h
dev1: mov r1,#30h ;Loading the address of the password
mov r3,#01h ;device no. used to give to the decoder
lcall scan
cjne a,#80h,unlock1 ;check for the lockunlock pressed
jmp lock1
unlock1: jnb 01h,error1 ;generating error if the selected device is already
;activated
lcall unlock
jb 0ah,hr1
clr 01h ;clear lockunlock flag
hr1: jmp start
lock1: jb 01h,error1
lcall lock
setb 01h ;set lockunlock flag
jmp start
error1: mov a,#40h ;activating the error LED
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
SELECTED DEVICE ACTIVATION
;***************************************************************
org 9200h
dev1: mov r1,#30h ;Loading the address of the password
mov r3,#01h ;device no. used to give to the decoder
lcall scan
cjne a,#80h,unlock1 ;check for the lockunlock pressed
jmp lock1
unlock1: jnb 01h,error1 ;generating error if the selected device is already
;activated
lcall unlock
jb 0ah,hr1
clr 01h ;clear lockunlock flag
hr1: jmp start
lock1: jb 01h,error1
lcall lock
setb 01h ;set lockunlock flag
jmp start
error1: mov a,#40h ;activating the error LED
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***************************************************************
dev2: mov r1,#035h
mov r3,#02h
lcall scan
cjne a,#80h,unlock2
jmp lock2
unlock2: jnb 02h,error2
lcall unlock
jb 0ah,hr2
clr 02h
hr2: jmp start
lock2: jb 02h,error2
lcall lock
setb 02h
jmp start
error2: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev2: mov r1,#035h
mov r3,#02h
lcall scan
cjne a,#80h,unlock2
jmp lock2
unlock2: jnb 02h,error2
lcall unlock
jb 0ah,hr2
clr 02h
hr2: jmp start
lock2: jb 02h,error2
lcall lock
setb 02h
jmp start
error2: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***************************************************************
dev3: mov r1,#03ah
mov r3,#03h
lcall scan
cjne a,#80h,unlock3
jmp lock3
unlock3:jnb 03h,error3
lcall unlock
jb 0ah,hr3
clr 03h
hr3: jmp start
lock3:jb 03h,error3
lcall lock
setb 03h
jmp start
error3: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev3: mov r1,#03ah
mov r3,#03h
lcall scan
cjne a,#80h,unlock3
jmp lock3
unlock3:jnb 03h,error3
lcall unlock
jb 0ah,hr3
clr 03h
hr3: jmp start
lock3:jb 03h,error3
lcall lock
setb 03h
jmp start
error3: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***************************************************************
dev4: mov r1,#040h
mov r3,#04
lcall scan
cjne a,#80h,unlock4
jmp lock4
unlock4:jnb 04h,error4
lcall unlock
jb 0ah,hr4
clr 04h
hr4: jmp start
lock4:jb 04h,error4
lcall lock
setb 04h
jmp start
error4: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev4: mov r1,#040h
mov r3,#04
lcall scan
cjne a,#80h,unlock4
jmp lock4
unlock4:jnb 04h,error4
lcall unlock
jb 0ah,hr4
clr 04h
hr4: jmp start
lock4:jb 04h,error4
lcall lock
setb 04h
jmp start
error4: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***************************************************************
dev5: mov r1,#045h
mov r3,#05h
lcall scan
cjne a,#80h,unlock5
jmp lock5
unlock5:jnb 05h,error5
lcall unlock
jb 0ah,hr5
clr 05h
hr5: jmp start
lock5:jb 05h,error5
lcall lock
setb 05h
jmp start
error5: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev5: mov r1,#045h
mov r3,#05h
lcall scan
cjne a,#80h,unlock5
jmp lock5
unlock5:jnb 05h,error5
lcall unlock
jb 0ah,hr5
clr 05h
hr5: jmp start
lock5:jb 05h,error5
lcall lock
setb 05h
jmp start
error5: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***************************************************************
dev6: mov r1,#04ah
mov r3,#06h
lcall scan
cjne a,#80h,unlock6
jmp lock6
unlock6:jnb 06h,error6
lcall unlock
jb 0ah,hr6
clr 06h
hr6: jmp start
lock6:jb 06h,error6
lcall lock
setb 06h
jmp start
error6: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev6: mov r1,#04ah
mov r3,#06h
lcall scan
cjne a,#80h,unlock6
jmp lock6
unlock6:jnb 06h,error6
lcall unlock
jb 0ah,hr6
clr 06h
hr6: jmp start
lock6:jb 06h,error6
lcall lock
setb 06h
jmp start
error6: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;**************************************************************
dev7: mov r1,#050h
mov r3,#07h
lcall scan
cjne a,#80h,unlock7
jmp lock7
unlock7:jnb 07h,error7
lcall unlock
jb 0ah,hr7
clr 07h
hr7:jmp start
lock7:jb 07h,error7
lcall lock
setb 07h
jmp start
error7: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***********************************************************
dev8: mov r1,#055h
mov r3,#08h
lcall scan
cjne a,#80h,unlock8
jmp lock8
unlock8:jnb 08h,error8
lcall unlock
jb 0ah,hr8
clr 08h
hr8: jmp start
lock8:jb 08h,error8
lcall lock
setb 08h
jmp start
error8: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
dev7: mov r1,#050h
mov r3,#07h
lcall scan
cjne a,#80h,unlock7
jmp lock7
unlock7:jnb 07h,error7
lcall unlock
jb 0ah,hr7
clr 07h
hr7:jmp start
lock7:jb 07h,error7
lcall lock
setb 07h
jmp start
error7: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***********************************************************
dev8: mov r1,#055h
mov r3,#08h
lcall scan
cjne a,#80h,unlock8
jmp lock8
unlock8:jnb 08h,error8
lcall unlock
jb 0ah,hr8
clr 08h
hr8: jmp start
lock8:jb 08h,error8
lcall lock
setb 08h
jmp start
error8: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***********************************************************
dev9: mov r1,#05ah
mov r3,#09h
lcall scan
cjne a,#80h,unlock9
jmp lock9
unlock9:jnb 09h,error9
lcall unlock
jb 0ah,hr9
clr 09h
hr9: jmp start
lock9:jb 09h,error9
lcall lock
setb 09h
jmp start
error9: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***********************************************************
; OUTPUT SECTION
;***********************************************************
org 0a000h
out: mov a,r3 ;loading the device number
mov dptr,#2041h
movx @dptr,a
ret
;***********************************************************
This program is assembled using DASM assembler and the hex file is downloaded to the 8051 microcontroller kit.
dev9: mov r1,#05ah
mov r3,#09h
lcall scan
cjne a,#80h,unlock9
jmp lock9
unlock9:jnb 09h,error9
lcall unlock
jb 0ah,hr9
clr 09h
hr9: jmp start
lock9:jb 09h,error9
lcall lock
setb 09h
jmp start
error9: mov a,#40h
mov dptr,#2040h
movx @dptr,a
push dptr
push r0
push r1
mov r0,#ffh
lcall 6798h
pop r1
pop r0
pop dptr
jmp start
;***********************************************************
; OUTPUT SECTION
;***********************************************************
org 0a000h
out: mov a,r3 ;loading the device number
mov dptr,#2041h
movx @dptr,a
ret
;***********************************************************
This program is assembled using DASM assembler and the hex file is downloaded to the 8051 microcontroller kit.
No comments:
Post a Comment