It works find I put 8 leds on PortB and the value of the led is output to PortB It give the value 1 to 12 just like It should
This is the thing if I test to see if the key pressed It doesn't keep but the las one. Maybe you can tell me
what I'm doing wrong
Code: Select all
Device = 18F1220
Clock = 8
Config OSC = INTIO2
Config MCLRE = OFF
Include "INTOSC8.bas"
Include "Utils.bas" // local duty variable...
#option KEYPAD_PORT = PORTA
Include "Keypad12.bas"
Dim Key As Byte
Dim a As Byte
Dim b As Byte
Dim c As Byte
Dim d As Byte
SetAllDigital
TRISB =%00000000
PORTB =%00000000
Key = 0
a = 0
b = 0
c = 0
d = 0
While True
If Keypad12.Value <> 0 Then
Key = Keypad12.Value
EndIf
If Key >0 Then // test to see if a key was pressed
Debounce
a = Key
// should make a have the value of key and put it in a
EndIf
If Key >0 Then // test to see if a key was pressed
Debounce
b = Key
// should make a have the value of key and put it in b
EndIf
If Key >0 Then // test to see if a key was pressed
Debounce
c = Key
// should make a have the value of key and put it in c
EndIf
If Key >0 Then // test to see if a key was pressed
Debounce
d = Key
// should make a have the value of key and put it d
EndIf
If a = 1 And d = 4 Then
PORTB = d
EndIf
Wend
I done this 100 ways and no go LOL. thanks