|
|||||
Chapter 3 problems |
- B3.12 - |
Designing an 8-bit comparator (μC - C) |
|||
|
1. Specifications
Design the 8-bit comparator represented in Fig. 1 using a PIC18F4520.
The same project is proposed in D1.12 (for 16-bit operands) as a combinational circuit based on logic gates.
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.
Comp_16bit design would be a similar design but using many more input pins, and they may not be available in in our target chip PIC18F4520.
|
|||||
Chapter 3 problems |
- B3.12 - |
- |
|||
|
Design....
The same project is proposed in D1.12 as a combinational circuit based on logic gates.
2. Planning
Project location:
Organise