Question: Question 4 (20 marks) A program written to interface a 4x4 keypad with a PIC18F microcontroller is listed as below static char keypad scan (void)

Question 4 (20 marks) A program written to interface a 4x4 keypad with a PIC18F microcontroller is listed as below static char keypad scan (void) const char key code /x-+963-8520741C unsigned char row, row scan, column, column_ scani columns can 0x08; for(colum0 column 4 colum++) PORTDcolumn scani row scan ~PORTD >> ; if (row scan!-0) row0; while ((row scan 2) == 0) row++ rowscan1; return (key code [column *4 row]) column scan >>= 1; return 0; Program 2 Analyze Program 2 in detail and answer the following questions (a) Identify the output pins of the microcontroller interfacing with the keypad. [6 marks] (b) By referring to the pin outs in the appendix, connect the keypad to the PIC18F4550 Include additional components such as pull-up resistors where necessary. Draw and [6 marks] label the diagram correctly (c) ) State the method used in Program 2 to check which key is pressed. [2 marks] (ii) Explain the operation of the method used in Program 2 to check which key is ressed 6 marks Question 4 (20 marks) A program written to interface a 4x4 keypad with a PIC18F microcontroller is listed as below static char keypad scan (void) const char key code /x-+963-8520741C unsigned char row, row scan, column, column_ scani columns can 0x08; for(colum0 column 4 colum++) PORTDcolumn scani row scan ~PORTD >> ; if (row scan!-0) row0; while ((row scan 2) == 0) row++ rowscan1; return (key code [column *4 row]) column scan >>= 1; return 0; Program 2 Analyze Program 2 in detail and answer the following questions (a) Identify the output pins of the microcontroller interfacing with the keypad. [6 marks] (b) By referring to the pin outs in the appendix, connect the keypad to the PIC18F4550 Include additional components such as pull-up resistors where necessary. Draw and [6 marks] label the diagram correctly (c) ) State the method used in Program 2 to check which key is pressed. [2 marks] (ii) Explain the operation of the method used in Program 2 to check which key is ressed 6 marks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
