AVR Microcontroller Problems 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
Answer: b
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: 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
Answer: d
Clarification: 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
Answer: a
Clarification: 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
Answer: a
Clarification: 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
a) load KCODE0 with 0
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
Answer: b
Clarification: 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
Answer: a
Clarification: 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
Answer: b
Clarification: 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
Answer: b
Clarification: Initially all keys are considered open in order to ensure the accuracy while identification of the pressed key.