Haven't you tried it yet??
I sure it contain some bugs but I did not confront by any.
Proteus simulation doesn't work properly I tried it on board it works well![]()
Haven't you tried it yet??
I sure it contain some bugs but I did not confront by any.
Proteus simulation doesn't work properly I tried it on board it works well![]()
Electrical & Electronic Engineering
Undergraduate Student
This simple snipet assume you receive the keypad character serially and that you have a LCD. The password is written on eeprom and lenght can be changed updating Plen constant.
At start program waits for six characters (in this example six zeroes) and if entries are ok then program proceed to mainloop otherwise print "Access Denied" and return to the PassLoop.
Code:Eeprom 100,[48,48,48,48,48,48] Pass var byte Key var byte Len var byte Char var byte A0 var byte Plen con 6 T9600 con 2 Key=0 len=0 Lcdout $FE,1 PassLoop: Serin pinx,T9600,Char Read 100+len,Pass iF pass=Char then Key=Key+1 else Key=0 endif Lcdout $FE, $80+len "*" Len=Len+1 If Len=Plen+1 then If Key=Plen then main else Lcdout $FE,1,"Access Denied" pause 2000 Lcdout $FE,1 Len=0 endif endif goto PassLoop Main:
Al.
Last edited by aratti; - 23rd February 2009 at 22:27.
All progress began with an idea
In previous code Variable Key was not resetted in case of retrail. Here a shorter corrected code.
Al.Code:Eeprom 100,[48,48,48,48,48,48] Pass var byte Key var byte Len var byte Char var byte A0 var byte Plen con 6 T9600 con 2 IniPass: Key=0 len=0 Lcdout $FE,1 PassLoop: Serin pinx,T9600,Char Read 100+len,Pass iF pass=Char then Key=Key+1 else Key=0 endif Lcdout $FE, $80+len "*" Len=Len+1 If Len=Plen+1 then If Key=Plen then main else Lcdout $FE,1,"Access Denied" pause 2000 goto IniPass endif endif goto PassLoop Main:
All progress began with an idea
I haven't tried myself, but for sure I never trust any Sim... Proper ICD setup is more valuable and work on real hardware.
Here's some other variant of password handling.
http://www.picbasic.co.uk/forum/showthread.php?t=5695
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks