Page 313 - ARM Based Microcontroller Projects Using MBED
P. 313

10.5 PROJECT 4—CALCULATOR USING A KEYPAD             299























































            FIG. 10.20  Program PDL.
            interrupt where the index of this key (0–15) is available inside the interrupt service routine. A
            key table must be defined at the beginning of the program with the names of the keys. By
            using the index we can find which key has been pressed.
              The program listing (program: Calc) is shown in Fig. 10.21. At the beginning of the pro-
            gram the header files, mbed.h, TextLCD.h, and keypad.h are included in the program.
            The interface between the LCD and the development board are defined as in the previous
            project. Also, the interface between the rows and columns of the LCD and the development
            board are defined. The rows of the keypad are connected to GPIO pins PC_6–PC_9. Similarly,
            the columns of the keypad are connected to GPIO pins PC_10–PC_13. The keypad characters
            are stored in an array called KeyTable. Inside the main program function KeyPadISR is
   308   309   310   311   312   313   314   315   316   317   318