hi everybody,
I just start in programing and i would like to make an security keypad. the keypad is a 4*4 connect to the 8 pin of portb like this
B0..1...2...3...A
B1..4...5...6...B
B2..7...8...9...C
B3..*...0...#...D
....B4..B5..B6..7
I using a 16f84 and picbasic pro 2.44

I would like to know how to compare a code enter by the keypad with the one store in the program.
I started like this:
trisa=%00000000
trisb=%11111111
code=123A
key1 var byte
key2 var byte
key3 var byte
keyA var byte
,etc for each key
key1 = portb.0 AND portb.4 at 0,
key2 = portb.0 AND portb.5 at 0,I DON'T KNOW HOW TO DO THIS PART
key3 = portb.0 AND portb.6 at 0,
keyA = portb.0 AND portb.7 at 0,
,etc for each key
key1:
check keypad IF key1 is press THEN key2 else key1,
key2:
check keypad IF key2 is press THEN key3 else key1,I DON'T KNOW HOW TO DO THIS PART TOO

key3:
check keypad IF key3 is press THEN key3 else key1,
key4:
check keypad IF key4 is press THEN YES else NO
yes:
high portA.0, green led
pause 5000
low portA.0
goto key1
no:
high portA.1, red led
pause 5000
low portA.1
goto key1
end

For sure is not the good way, if somebody can give me help on this
thanks