help! pic 16f84a!

Thread Starter

habarabadabas

Joined Apr 16, 2014
6
good day guys.. im just wondering, how do you make a code to enable a 3.input password, wherein it requires you to input the codes correctly, in the correct order. whenever you failed to input the password correctly, an LED will blink. note that im using a pic16f84a and, assembly language just isnt my kind of thing. any replies would be greatly appreciated..
 

Thread Starter

habarabadabas

Joined Apr 16, 2014
6
Here is my problem sir, my code neglects the order of however you enter the password.
Pressing 1-2-3, activates "kr", the special function. Pressing 1-2-4-5-1-2-3, 1-2-1-3, 2-1-2-3 etc, as long as 1-2-3 is entered in order, the special function still activates. Could you please look into it. I would be very grateful..

I need it to function like whenever you enter the wrong combination, like 1-4-2, it would activate an error function. :)


View attachment CODE.txt
 

ericgibbs

Joined Jan 29, 2010
18,872
hi,
The code is not for a 16F84A.??
The following are Reserved locations for SFR's.??, not code.

Rich (BB code):
DCNT0    equ    h'07'
DCNT1    equ    h'08'
DCNT2    equ    h'09'
DCNT3    equ    h'10'

KCNT0    equ    h'11'
KCNT1    equ    h'12'
KCNT2    equ    h'13'
KCNT3    equ    h'14'

KRPASS0    equ    H'05'
 

Attachments

Thread Starter

habarabadabas

Joined Apr 16, 2014
6
hmmm last time we compiled the code it worked; the passcode being 1-2-3 at any order.
I was wondering what to do with the KRPW0-KPRW1 to make the passcode work in the order 1-2-3, without pressing any other keys.
 

ericgibbs

Joined Jan 29, 2010
18,872
hi,
Your code waits for PORT0,1,2 to be switched Hi and Lo in the correct sequence OK.

What do you expect this KR code to do,??

Rich (BB code):
KR  MOVLW    b'10000000'
    MOVWF    h'06'
KL0    MOVLW    d'7'
    MOVWF    KCNT0
KL1    CALL    DELAY1
    BCF    h'03', 0
    RRF    h'06', F
    DECFSZ    KCNT0, F
    GOTO    KL1
    MOVLW    d'7'
    MOVWF    KCNT0
KL2    CALL    DELAY1
    BCF    h'03', 0
    RLF    h'06', F
    DECFSZ    KCNT0, F
    GOTO    KL2
    GOTO    KL0
 

Thread Starter

habarabadabas

Joined Apr 16, 2014
6
oh, thats when the connected LEDs start to blink from the left to the right then vice versa. the PW should be pressed for the LEDs to blink.
 

ericgibbs

Joined Jan 29, 2010
18,872
hi,
After switching PORTA,0,1,2 in sequence, PORTB cycles thru 0,...7 and 7... 0 continuously.
Thus zip file contains a screen shot AVI file , use Windows Media to view.

E
 

Attachments

Markd77

Joined Sep 7, 2009
2,806
You need to change the code so that in the three sections waiting for a keypress, they look for any keypress, then check if it is the right one. But then you will have another problem because in the few microseconds it takes to get to the second function the key will still be pressed. So in between checking for each press you need to check for the key (all keys?) being released. But then you have another problem because keys bounce, so add a short (20ms) delay after keys are released while checking that they stay released.
While testing these things it is handy to light a different LED to indicate which stage you are at.
 
Top