|
|||||
Chapter 3 problems |
- B3.4 - |
1-digit BCD adder with EXE (interrupts, edge detection) |
|||
|
1. Specifications
A good example to see how the interrupt mechanism for detecting signal edges works is for instance: modify the Adder_BCD_1digit in P9 so that the truth table is calculated only when EXE pushbutton is pressed. This means that even if the input operands are changed, only after clicking EXE the results will be displayed.
![]() |
Fig. 1. Adder_BCD_1digit circuit modified with EXE input |
Some questions to organise the project:
- Copy Adder_BCD_1digit.pdsprj to the new project folder and adapt the hardware circuit from P9.
- Study the INT0 mechanism and how it is configured in init_system(). Consider hardware flag INT0F and its software variable: var_EXE_flag.
- Modify the software flowchart so that truth_table() is executed only once var_EXE_flag is set.
- Write the software source file Adder_BCD_1digit.c. Start an MPLABX - XC8 project targeted to the PIC18F4520 chip.
- Start compiling and testing (debugging) interactively watching variables and using step-by-step execution.
- How long does it take to execute the ISR()?