|
|||||
Chapter 3 problems |
- B3.5 - |
Designing an 8-bit comparator |
|||
|
1. Specifications
Design the 8-bit comparator represented in Fig. 1 using a PIC18F4520.
![]() |
Fig. 1. Comp_8bit symbol. |
Some questions to organise the project:
- Use the pin connections represented in Fig. 1.
- List all the RAM variables involved in this design.
From a simiar tutorial in P9 or LAB9 where to copy and adapt to the project location folder:
- Draw an sketch of the hardware circuit and capture it in Proteus Comp_8bit.pdsprj
- Write the software source file Comp_8bit.c. Start an MPLABX - XC8 project targeted to the PIC18F4520 chip. Use our software organisation.
As we have decided, start compiling and testing one input or output at a time:
- Write the funcion init_system(). Start configuring only one input, compile and test. Describe using pictures and annotations how you are configuring registers.
- Write the funcion read_inputs(). Start reading only one input, compile and test. Describe using pictures and annotations how you are reading an input using bitwise C instructions.
- Write the funcion write_outputs(). Start writing only one output, compile and test. Describe using pictures and annotations how you are writing a RAM variable in the corresponding pin using bitwise C instructions.
- Translate the truth table to C code and complete truth_table().
- Check the full project and report.