| ||
SP3_1: On basic digital I/O. Designing a combinational circuit |
||
NOTE: This subproject must be solved only after having completed successfully lab session Lab9 because you will copy and adapt materials from it. |
1. Specifications
Comp_4bit for radix-2 numbers was already discussed in P3 Chapter 1. Its symbol is reproduced in Fig. 1. It is a combinational circuit for calculating arithmetic comparisons.
In Chapter 3 we implement the 9th plan of solving logic functions. Thus, another aim of this project is comparing this new method based on programming a μC in C language with respect to all the other methods based on pure hardware design.
Use a μC PIC18F4520 and its IDE tools.
Use CSD hardware and software organisation styles.
|
Fig. 1. Symbol |
Remember its truth table and how it works when applying input stumulus in time (Fig. 2).
Fig. 1. Truth table and example of timing diagram. |
2. Planning
Follow the same procedure studied in Lab9 tutoriaL{Dual_MUX_4} or in P9 {Adder_BCD_1digit}
Hardware schematic (adding switches, buttons and LED to the circuit represented in Fig. 1 in Proteus, so it can be depicted as in Fig. 3.
Project location:
C:\CSD\P_Ch3\SP3_1\(files)
Fig. 3. Hardware circuit. Comp_4bit symbol and PIC18F4520 pin connections. |
Software (MPLABX + XC8). Hardware-software diagram, RAM variables, init_system(), read_inputs(), write_outputs() and truth_table().
This flowchart below in Fig. 4 is an example of discussion (be aware that the pinning may be different from Fig. 3) on reading operations: from pins to RAM variables.
Fig. 4. Procedure for reading/polling digital inputs. |
And below in Fig. 5 is represented another example of flowchart on interpreting the truth table behaviourally. Complete the flowchart and deduce its C code equivalent.
Fig. 5. Truth table interpretation. |
3. Developing and 4. testing
And again: use separate sheets of paper and the correct folder location for your projects. Remember that this exercise must be solved only after having completed lab session Lab9.
Solve the circuit (develop & test) step by step using watch window for debugging purposes. One signal at a time.
-. This is the hardware circuit Comp_4bit.pdsprj that you can adapt and use to start capturing the schematic.
- This is the Comp_4bit.c source file with some operations. Run MPLABX project. You can start compiling verify that you can read correctly a pin like Gi --> Var_Gi. Watch variables in watch windows while debugging. Complete the application step by step.
5. Report
Follow this rubric for writing reports.