general purpose password protected menu


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Ankara,TURKEY
    Posts
    45


    Did you find this post helpful? Yes | No

    Default code and simulation

    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

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    In previous code Variable Key was not resetted in case of retrail. Here a shorter corrected code.

    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:
    Al.
    All progress began with an idea

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HYETİK View Post
    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
    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.

Similar Threads

  1. lcd menu problems
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd April 2009, 19:00
  2. interactive menu with hyperterminal
    By jamied in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 5th January 2009, 11:13
  3. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 07:31
  4. Sending menu to PC from PIC16F876A
    By joseph Degorio in forum Serial
    Replies: 2
    Last Post: - 12th November 2007, 07:03
  5. A little DTMF help
    By Travin77 in forum mel PIC BASIC Pro
    Replies: 48
    Last Post: - 30th May 2006, 01:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts