Download EXPERIMENTING with the PICBASIC PRO

Transcript
Experimenting with the PicBasic Pro Compiler
Interfacing with a keypad
For example, in its raw state, KEY will hold the value 0 if the one key has
been pressed, 10 if the zero key has been pressed, and 12 if no
keypress has been detected, therefore, the thirteen values within the
braces of the LOOKUP command correspond to the raw KEY values and
the expected keypad legend values .
The program KEYTST12 .BAS does the same as KEYPAD12 .BAS, but
the INKEYS subroutine is loaded in as an include file : Include "INKEYS12.INC"
`Place this at the beginning of the program .
To
Serial LCD
N9600 baud
5 Volts
VDD RB7
MCLR RB6
RB5
RB4
RB3
0SC1 RB2
RB1
RBO
PIC16F84
RA4
OSC2 RA3
RA2
RA1
RAO
vss
Figure 2 .2 . 12-button Keypad Circuit .
Section-2 - 3