Table of Contents

Advertisement

Fig 2.4
Here, SW5 and SW3 are the only keys pressed and because only SW3 is connected to 0v,
only PortC2 reads as 0.
SW5 is also pressed, but because PortB0 is set up as an input, it means the switch acts as
in Fig 2.3.
To read the bottom row, we set up PortD7 back to being an input and make PortB0 an out-
put, ouputting 0. This time SW3 has no effect on PortC inputs, but SW5 does, meaning
PortC3 to PortC0 will read 1110.
KeyScan-
In the FiGnition firmware, the basic switch reading is handled by the 'C' function
Raw
in the manner described here.

2.2.2 Ghost Keys

A switch-matrix keyboard can't read more than two keys at a time without getting con-
fused. Let's see what happens if we press SW1, SW3 and SW5. When the bottom row is
being read we can see that there is also a connection between PortC2 and PortB0, be-
cause PortC2 connects to SW3 which connects to SW1 which connects to PortC0. So it
looks like SW7 is also being pressed [Fig 2.5].

Advertisement

Table of Contents
loading

Table of Contents