Combinaton Gate access


Closed Thread
Results 1 to 40 of 48

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Talking

    It works of this form?


    Code:
    @MyConfig = _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF 
    @MyConfig = MyConfig & _BODEN_OFF 
    @ __config  MyConfig
    '@ __CONFIG _HS_OSC & _WDT_ON & _PWRTE_ON  & _LVP_OFF & _CP_OFF
    Define PIC16F877A
    @ errorlevel -230
    CMCON  = 7  
    ADCON1 = 7 
    define OSC 20
    TrisD = %00000000
    
    DEFINE LCD_DREG PORTA
        DEFINE LCD_DBIT 0
        DEFINE LCD_RSREG PORTA
        DEFINE LCD_RSBIT 5
        DEFINE LCD_EREG PORTA
        DEFINE LCD_EBIT 4
        DEFINE LCD_BITS 4
        DEFINE LCD_LINES 4
    
        include "keypad.bas"
    pause 1000
    lcdout 254,1
    lcdout 254,128,"PIC Self Test"
    pause 1000
        
        DEFINE KEYPAD_ROW        4        ' 4 ROW keypad       
        DEFINE KEYPAD_ROW_PORT   PORTB    ' ROW port = PORTB
        DEFINE KEYPAD_ROW_BIT    4        ' ROW0 = PORTB.4
        DEFINE KEYPAD_COL        4        ' 3 COL keypad
        DEFINE KEYPAD_COL_PORT   PORTB    ' COL port = PORTB
        DEFINE KEYPAD_COL_BIT    0        ' COL0 = PORTB.1
        DEFINE KEYPAD_DEBOUNCEMS 50       ' debounce delay = 50 mSec
        DEFINE SCAN_ONCE         1
    
        OPTION_REG.7 = 0        ' Enable internal crap pull-up :D
    
        PORTB = 0             '  
        TRISB = %11110000     '
        Flags = 0  
        ByteA var byte         '
        Combocount var byte 
            INTCON = %10001000    ' Enable global interrupt
                              ' Enable interrupt on PORTB change
        on interrupt goto KeypadInt
        CLEAR
    
    Portd.2 = 0
    combocount = 0
    
    Init:    
        lcdout $FE,1,"Press any Key"
     disable
    KeypadINT:    
    @ READKEYPAD _ByteA
        TRISB=%11110000
        PORTB=0
        INTCON.0=0
        resume
    enable   
        
        
    Start:
        if ByteA then
        If ByteA = 4  then ByteA = "A"
        if ByteA = 5  then ByteA = 4
        if ByteA = 6  then ByteA = 5
        if ByteA = 7  then ByteA = 6
        if ByteA = 8  then ByteA = "B"
        if ByteA = 9  then ByteA = 7
        if ByteA = 10 then ByteA = 8
        if ByteA = 11 then ByteA = 9
        if ByteA = 12 then ByteA = "C"
        if ByteA = 13 then ByteA = "*"
        if ByteA = 14 then ByteA = 0
        if ByteA = 15 then ByteA = "#"
        if ByteA = 16 then ByteA = "D"
        if ByteA != 0 then  gosub combo
            
            ByteA = 0
            pause 1000
            goto init
            'else
               
    else   
    endif
    goto start
    
    combo:
        IF (combocount = 0) and (ByteA = 7)   then GoodKey
        IF (combocount = 1) and (ByteA = 8)   then GoodKey
        IF (combocount = 2) and (ByteA = "A") then GoodKey
        IF (combocount = 3) and (ByteA = 5)   then GoodKey
        IF (combocount = 4) and (ByteA = "D") then GoodKey
        combocount = 0 ; invalid keypress
    return
    
    GoodKey:
        combocount = combocount + 1
        if combocount = 5 then GrantAccess
    return
    goto init ' Combination 78A5D
    
    
    GrantAccess:
    hight portd.2
    pause 1000
    low portd.2
    pause 1000
    
    ByteA = 0
    Combo1 = 0
    
    
    end

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo View Post
    It works of this form?


    Code:
    @MyConfig = _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF 
    @MyConfig = MyConfig & _BODEN_OFF 
    @ __config  MyConfig
    '@ __CONFIG _HS_OSC & _WDT_ON & _PWRTE_ON  & _LVP_OFF & _CP_OFF
    Define PIC16F877A
    @ errorlevel -230
    CMCON  = 7  
    ADCON1 = 7 
    define OSC 20
    TrisD = %00000000
    
    DEFINE LCD_DREG PORTA
        DEFINE LCD_DBIT 0
        DEFINE LCD_RSREG PORTA
        DEFINE LCD_RSBIT 5
        DEFINE LCD_EREG PORTA
        DEFINE LCD_EBIT 4
        DEFINE LCD_BITS 4
        DEFINE LCD_LINES 4
    
        include "keypad.bas"
    pause 1000
    lcdout 254,1
    lcdout 254,128,"PIC Self Test"
    pause 1000
        
        DEFINE KEYPAD_ROW        4        ' 4 ROW keypad       
        DEFINE KEYPAD_ROW_PORT   PORTB    ' ROW port = PORTB
        DEFINE KEYPAD_ROW_BIT    4        ' ROW0 = PORTB.4
        DEFINE KEYPAD_COL        4        ' 3 COL keypad
        DEFINE KEYPAD_COL_PORT   PORTB    ' COL port = PORTB
        DEFINE KEYPAD_COL_BIT    0        ' COL0 = PORTB.1
        DEFINE KEYPAD_DEBOUNCEMS 50       ' debounce delay = 50 mSec
        DEFINE SCAN_ONCE         1
    
        OPTION_REG.7 = 0        ' Enable internal crap pull-up :D
    
        PORTB = 0             '  
        TRISB = %11110000     '
        Flags = 0  
        ByteA var byte         '
        Combocount var byte 
            INTCON = %10001000    ' Enable global interrupt
                              ' Enable interrupt on PORTB change
        on interrupt goto KeypadInt
        CLEAR
    
    Portd.2 = 0
    combocount = 0
    
    Init:    
        lcdout $FE,1,"Press any Key"
     disable
    KeypadINT:    
    @ READKEYPAD _ByteA
        TRISB=%11110000
        PORTB=0
        INTCON.0=0
        resume
    enable   
        
        
    Start:
        if ByteA then
        If ByteA = 4  then ByteA = "A"
        if ByteA = 5  then ByteA = 4
        if ByteA = 6  then ByteA = 5
        if ByteA = 7  then ByteA = 6
        if ByteA = 8  then ByteA = "B"
        if ByteA = 9  then ByteA = 7
        if ByteA = 10 then ByteA = 8
        if ByteA = 11 then ByteA = 9
        if ByteA = 12 then ByteA = "C"
        if ByteA = 13 then ByteA = "*"
        if ByteA = 14 then ByteA = 0
        if ByteA = 15 then ByteA = "#"
        if ByteA = 16 then ByteA = "D"
        if ByteA != 0 then  gosub combo
            
            ByteA = 0
            pause 1000
            goto init
            'else
               
    else   
    endif
    goto start
    
    combo:
        IF (combocount = 0) and (ByteA = 7)   then GoodKey
        IF (combocount = 1) and (ByteA = 8)   then GoodKey
        IF (combocount = 2) and (ByteA = "A") then GoodKey
        IF (combocount = 3) and (ByteA = 5)   then GoodKey
        IF (combocount = 4) and (ByteA = "D") then GoodKey
        combocount = 0 ; invalid keypress
    return
    
    GoodKey:
        combocount = combocount + 1
        if combocount = 5 then GrantAccess
    return
    goto init ' Combination 78A5D
    
    
    GrantAccess:
    hight portd.2
    pause 1000
    low portd.2
    pause 1000
    
    ByteA = 0
    Combo1 = 0
    
    
    end
    No Leonardo,
    Use the code Darrel posted in post #9 above, or the version of it, I sent you.
    JS
    Last edited by Archangel; - 13th February 2007 at 22:42.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default One more question

    As this is my first venture into eprom, and I understand how to change the value and number of digits prior to compiling, my question is this: once the chip is programmed, is the eprom value fixed, or can it be changed?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    As this is my first venture into eprom, and I understand how to change the value and number of digits prior to compiling, my question is this: once the chip is programmed, is the eprom value fixed, or can it be changed?
    Do you mean the on chip eeprom (which would be easier to use and is documented in the manual and is the method I'd use) or actual program flash (which would take a bit more code and would be harder)?

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Do you mean the on chip eeprom (which would be easier to use and is documented in the manual and is the method I'd use) or actual program flash (which would take a bit more code and would be harder)?
    RTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFM . . .Darn it skimask, I got some records that do that
    I'm goin' to take that as a yes, use the write command. What
    I think I am trying to do is change the combination on a chip
    that is already programmed with this program. SO to clarify
    my question, how the heck would I do that? Would it require
    another loop or a serin write, Black Cat bones?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    RTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFMRTFM
    RTFMRTFMRTFMRTFMRTFMRTFMRTFM . . .Darn it skimask, I got some records that do that
    I'm goin' to take that as a yes, use the write command. What
    I think I am trying to do is change the combination on a chip
    that is already programmed with this program. SO to clarify
    my question, how the heck would I do that? Would it require
    another loop or a serin write, Black Cat bones?
    No, no, no, I didn't mean for you to RTFM...this time I was only pointing it out, making sure.

    I think I would set it up with a 'stock' combo when you program it set up in eeprom, say 12345 (that's amazing, I've got the same combination on my luggage!)...
    Then, there's one sequence of numbers that only you know and will never tell anybody (call it a 'back door')...say, 1234567890.. If you get that sequence, the system knows that the next 5 numbers input will be the new combination and you have to enter them twice. Then save those new 5 numbers in the eeprom (read, write), and BAM the combo is changed.

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    No, no, no, I didn't mean for you to RTFM...this time I was only pointing it out, making sure.

    I think I would set it up with a 'stock' combo when you program it set up in eeprom, say 12345 (that's amazing, I've got the same combination on my luggage!)...
    Then, there's one sequence of numbers that only you know and will never tell anybody (call it a 'back door')...say, 1234567890.. If you get that sequence, the system knows that the next 5 numbers input will be the new combination and you have to enter them twice. Then save those new 5 numbers in the eeprom (read, write), and BAM the combo is changed.
    Clever Idea, backdoor . . . like in WAR GAMES . . and I bet you thought I was going to make some jokes , That's going to be too much brain damage for now, tomorrow when I'm fresh, I will throw some spaghetti on the stove, and see what cooks out of it
    Maybe if I am lucky sayzer or mister_e will send me some coffee
    Thanks
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. A logic gate chip with 1 ea XOR and 2 ea AND gates?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 5th August 2009, 05:29
  2. Access to sim memu
    By sahin5002 in forum GSM
    Replies: 2
    Last Post: - 16th June 2009, 11:57
  3. truck gate
    By Melros in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 13th October 2007, 13:23
  4. 18f2550 'access is denied' USB error?
    By Giulio in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th December 2006, 14:29
  5. FYI - How to Access individual bytes in Word Arrays
    By Melanie in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th July 2003, 21:56

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