# AVR Microcontroller Questions and Answers – Keyboard Interfacing

This set of AVR Microcontroller Problems focuses on “Keyboard Interfacing”.

1. In reading the columns of a keyboard matrix, when no key is pressed then all the pins show?
a) 0
b) 1
c) F
d) 7

Explanation: When no key is pressed, in a keyboard then all the pins will read 1 as they all are connected to the main power supply.

2. To see if any key is pressed, all rows are grounded.
a) true
b) false
c) can’t be said
d) depends on the conditions

Explanation: To see that whether any key is pressed or not then all the rows are grounded so that columns can be read to deliver the better results.

3. Identify the row and the column for the following case when for the row D3-D0= 1110 and for the column D3-D0= 1101
a) first row and second column
b) first row and third column
c) second row and first column
d) second row and second column

Explanation: To identify the key that is pressed from this particular combination, we obtain that the key belongs to the first row and the second column as the D0 bit of the row port and the D1 bit of the column port are zero.

4. What are the actual steps that are followed in identifying any key that is being pressed?
a) wait for the debounce time
b) identify the key that is pressed
c) initially no key should be pressed
d) all of the mentioned

Explanation: In order to identify that which key is actually pressed form a particular format of a 3*3 matrix keyboard, we firstly ensure all initially all the keys are open, then we press a key and check that whether the key is actually pressed or not by waiting for a time span of 20mseconds, after this we identify the key that is pressed by masking the bits of the port. In this particular format, we can identify the key that is actually pressed.

5. To identify that the key is present in which row and the column
a) we ground the bits of the row one by one
b) we ground the bits of the column one by one
c) we connect the bits of the row to the logic level 1 one by one
d) we can connect the columns to the logic level 1 one by one

Explanation: To determine that the pressed key is in which row and column, we ground the rows one by one to determine the column by masking the bits separately.

6. The key detection and the key identification are two different procedures?
a) true
b) false
c) depends on the circumstances
d) difficult to tell

Explanation: The key detection and the key identification are the two different procedures, one is used to detect that whether any key is pressed or not and the other technique is used to find that the pressed key is located in which row and column.

7. What is described by the following command?
KCODE0<<1
b) rotate the contents of the KCODE0 register to the right
c) rotate the contents of the KCODE0 register to the left
d) none of the mentioned

Explanation: KCODE0<<1 means to rotate the contents of the KCODE0 register to the left after every loop.

8. If the pins of the keyboard are used as an interrupt, then these pins will cause an interrupt of what type?
a) External hardware interrupt
b) Timer interrupt
c) TI/RI interrupt
d) None of the mentioned

Explanation: The pins of the keyboard act as an external hardware interrupt as some external pulse is helping in generating this interrupt.

9. What will happen if the two keys of the keyboard are pressed at a time?
a) both the keys will be displayed on the screen
b) the key which is being actually pressed(for more then 20microseconds) will be displayed
c) the key that is pressed first will be displayed
d) none of the mentioned

Explanation: If two or more keys are pressed at a time, then the key that will be pressed for more then 20 microseconds will be displayed on the screen.

10. Why initially all keys are considered open before detecting the key pressed?
a) to make the task easy
b) to remove the errors caused by other pressing keys during detection
c) to remove the flow problems
d) none of the mentioned

Explanation: Initially all keys are considered open in order to ensure the accuracy while identification of the pressed key.

Sanfoundry Global Education & Learning Series – Microcontroller.

To practice all areas of Microcontroller Problems, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]