Design and Technology
My Own Personal Yellow Brick Road
Programming
Categories: Design Process

As the basic programme stands the safe lock resets after 5 seconds, this is not useful if you are taking anything out as you would have to re-enter the code to pull back the bolt to close the door. I need to be able to control the lock timing. I’d like to do this by altering the programming to keep the lock open until a certain key is pushed e.g. the hash key. This would enable the user to unlock the safe, remove what they wish, close the door and push a key to lock. So,lets have a look at the basic programme…

 

To enable the button press to be registered the microcontroller will need to begin scanning the keypad again. There is already a sub routine for the scanning process as you can see below:

So I will need to ask the microconroller to restart the scan and to look out for a particular key press, here is what I’ve come up with:

At each of the red starred points I have made a change. The first is to input a new test point, by labeling it ‘test 5′ the PIC knows that the key pressed after the 4 digit code is the locking key. The next change is to alter the ‘wait 5′ to ask the chip to scan again so I have asked it to call the scan sub routine (goto scan) and the last is to specify which key will lock the safe (key_value 12 is specifying the hash key as it’s numeric place on the key pad is 12). Let’s see if it works…

OH NO!! The chips memory is not big enough to take my changes! I’ve only added 3 extra lines of code but it wont fit >:( As it is now too late in the day to get a replacement chip I will have to be satisfied by altering the time the lock stays open for to 30 sec. This should give enough time to open, take what you need and close.

Leave a Reply

You must be logged in to post a comment.