keypad using 74c922
Archiver
Posts: 46,084
Hello Stampers,
I am designing a burglar alarm
The "entrance check" uses a 16 key keypad in combination with a 74c922
decoder. (like the application note on page 81 in the basic stamp
programming manual 1.9 but without the LCD)
The hardware works and with the following code I can display the "pushed
button code" on the debug screen
(sorry, I use Dutch labels, I'm living in Belgium)
key_val var ina 'the datalines are connected to in0
- in3
key_av con 4 'the data available is connected to
in4
'
bttnvar var byte 'used by "BUTTON"
keyvalue var nib 'variable containing pushed button
code
'
bttnvar=0 'used by "BUTTON"
'
'Capteren van ingedrukte toets op numpad (get the pushed button)
debug CLS
testlusje:
gosub haaltoets
debug DEC ? key_val
debug BIN4 ? key_val
goto testlusje
'
'Einde van programma (End the program)
loop: goto loop
end
'
''*************************************************** SUBROUTINES
*********************************
'
'HAALTOETS, deze subroutine wacht op het indrukken van een toets, na het
indrukken staat de ingedrukte toets in KEY_VAL
haaltoets:
wacht_op_toets: button key_av,1,255,0,bttnvar,0,geen_toets_ingedrukt
return
geen_toets_ingedrukt: goto wacht_op_toets
'
What 's the problem, the BUTTON command waits until a key is pressed (a
data availabe is generated by the 74c922) and the program halts, but I want
that the code is entered (and validated) within 30 seconds, if not the
program must continue and produce an alarm situation.
How can the program meassure the 30 seconds interval, meanwhile looking for
the keypad (a for digit entrance code will be used)?
Sorry, my English isn't that perfect but I'm trying ;-)
Greetz and thx in advance
Michel De Meester
Met vriendelijke groetjes,
> ************************************************
> Michel De Meester
> Biotechnisch Onderhoud
> Universitair Ziekenhuis Antwerpen
> Wilrijkstraat 10
> 2650 Edegem - B
> tel: 03/821.3647
> e-mail: michel.de.meester@u...
>
> *************************************************
>
>
I am designing a burglar alarm
The "entrance check" uses a 16 key keypad in combination with a 74c922
decoder. (like the application note on page 81 in the basic stamp
programming manual 1.9 but without the LCD)
The hardware works and with the following code I can display the "pushed
button code" on the debug screen
(sorry, I use Dutch labels, I'm living in Belgium)
key_val var ina 'the datalines are connected to in0
- in3
key_av con 4 'the data available is connected to
in4
'
bttnvar var byte 'used by "BUTTON"
keyvalue var nib 'variable containing pushed button
code
'
bttnvar=0 'used by "BUTTON"
'
'Capteren van ingedrukte toets op numpad (get the pushed button)
debug CLS
testlusje:
gosub haaltoets
debug DEC ? key_val
debug BIN4 ? key_val
goto testlusje
'
'Einde van programma (End the program)
loop: goto loop
end
'
''*************************************************** SUBROUTINES
*********************************
'
'HAALTOETS, deze subroutine wacht op het indrukken van een toets, na het
indrukken staat de ingedrukte toets in KEY_VAL
haaltoets:
wacht_op_toets: button key_av,1,255,0,bttnvar,0,geen_toets_ingedrukt
return
geen_toets_ingedrukt: goto wacht_op_toets
'
What 's the problem, the BUTTON command waits until a key is pressed (a
data availabe is generated by the 74c922) and the program halts, but I want
that the code is entered (and validated) within 30 seconds, if not the
program must continue and produce an alarm situation.
How can the program meassure the 30 seconds interval, meanwhile looking for
the keypad (a for digit entrance code will be used)?
Sorry, my English isn't that perfect but I'm trying ;-)
Greetz and thx in advance
Michel De Meester
Met vriendelijke groetjes,
> ************************************************
> Michel De Meester
> Biotechnisch Onderhoud
> Universitair Ziekenhuis Antwerpen
> Wilrijkstraat 10
> 2650 Edegem - B
> tel: 03/821.3647
> e-mail: michel.de.meester@u...
>
> *************************************************
>
>