The 8051 Microcontroller and Embedded

(lily) #1
Department of Computer Scien

ce and Information Engineering

National Cheng Kung University, TAIWAN
HANEL

KEYBOARD INTERFACING Scanning and Identifying the


Key


‰A 4x4 matrix connected to two ports


¾The rows are connected to an output port and the columns are connected to an input port


Matrix Keyboard Connection to ports

3 7 B F

2 6 A E

1 5 9 D

0 4 8 C

D3

D2

D1

D0

D0 D1 D2 D3 Port 1(Out)

Port 2(In)

Vcc

If no key has been pressed, reading the input port will yield 1s for all columns since they are all connected to high (V

)cc

If all the rows are grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the path to ground
Free download pdf