Académique Documents
Professionnel Documents
Culture Documents
• Keypads
• Review the Bitwise C Operators to interface
with Hardware
High
High
High
High
High
High
High
High
High
High
High
High
Low
High
High
High
High
Low
High
High
High
High
High
High
High
High
Low
Low
High
High
High
High
Microcontroller
74922
KEYPAD
ENCODER
C D E F 1
DAV
8 9 A B
4 5 6 7 D3 0
D2 1
0 1 2 3 D1 0
D0 1
ECET 209 Purdue University 22
Keypad Example
74922
KEYPAD
ENCODER
DAV PORTA.4
D3 PORTA.3
D2 PORTA.2
D1 PORTA.1
D0 PORTA.0
ECET 209 Purdue University 30
Masking for DAV
• For Lab #5
– Wait for a key to be pressed (DAV goes high)
– Read the key value
– Wait for key release (DAV goes low)
– Place the value on the LEDs
– Send the value out the serial port
– Loop back to the Top
while (PINA.4 == 1)
DAV
DATA 0101
DAV
DATA 0101
DAV
DATA 0101
key = KEYPAD_DATA;
ECET 209 Purdue University 40
Press Release
DAV
DATA 0101
Wait for
Not Dav Read the Key
• For Lab
– Wait for key release (DAV goes low)
– Wait for a key to be pressed (DAV goes high)
– Read the key value
– Place the value on the LEDs
– Send the value out the serial port
– Loop back to the Top