If a large number of keys have to be scanned, the individual keys are not normally connected directly to the microcontroller. Instead, a matrix arrangement is used. This allows the number of port pins to be reduced to seven for twelve keys, for example. The software scans the rows and columns and thus determines which key is pressed. However, sometimes only a small microcontroller with just a few port pins is available, so even this economical matrix method cannot be used.Using a trick, the same problem can be solved using only four port pins. This requires the use of four extra diodes and the possibility of individually configuring the pins as either inputs or outputs via software.
Discussion (0 comments)