Digital circuits that are found inside microcontrollers.
Design the following 4 combinational logic circuits and breadboard them in your home laboratory.
Combinational Logic uses a combination of basic logic gates AND, OR and NOT to create complex functions. For each output, the design procedure is:
Required reading
In the Raspberry Pico, Pin 27 can be used either as a DIO1 (GP21) or a I2C Clock (I2C0 SCL). In the Pico, a Select input to a 1 to 2 Demultiplexer routes Pin 27 to either the DIO or the I2C Clock.
In your first exercise
Note 1: GP 21 of the Pico is a Digital Input/Output. Our design only works for the digital input part.
In microcontrollers, a counter is commonly used in programming. A typical instruction is i = i + 1 where 1 is added to the variable i. In this exercise you will learn how addition is implemented in digital electronics.
In elementary arithmetic, a carry is a digit that is transferred from one column of digits to another column of more significant digits. The concept of carry is the same regardless we are doing decimal or binary maths.
The half adder is a digital circuit that adds two one-bit binary numbers A and B. The output is the (S)um of the two bits and the (C)arry.
In this exercise
Understanding of basic binary arithmetic is required for this exercise. See binary addition if you need further information.
Interrupts are used in microcontrollers to allow it to respond to external events by suspending current processing and switching to the routine to service the interrupt. Below is the top 4 in priority order of the interrupts of the Atmega328 microcontroller used in the Arduino.
The priority order means that regardless what happens to 3, 4 if 2 External Interrupt Request 0 occurs, it will be executed and the rest of the interrupts will have to wait until 2 is serviced. If there are ONLY 4 interrupts, a 4 to 2 Priority Encoder can be used to implement this function.
A 4 to 2 priority encoder provide 2 bits of binary coded output representing the position of the highest order active input of 4 inputs. If two or more inputs are high at the same time, the input having the highest priority will take precedence. In this design I3 has the highest priority and I0 the lowest .
In this partial truth table, for all the non-explicitly defined input combinations (i.e. inputs containing 2, 3, or 4 high bits) the lower priority bits are shown as don't cares (X). Similarly when the inputs are 0000, the outputs are not valid and therefore they are XX.
I3 | I2 | I1 | I0 | O1 | O0 |
0 | 0 | 0 | 0 | X | X |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 1 | X | 0 | 1 |
0 | 1 | X | X | 1 | 0 |
1 | X | X | X | 1 | 1 |
Design a circuit that compares two 2-bits natural numbers A (A1,A0) and B (B1,B0) providing an output S such that
Note: A1, B1 is MSB (most significant bit) and A0, B0 is LSB (least significant bit)
Understanding of basic binary arithmetic is required for this exercise. See binary addition if you need further information.
Congratulations! If you have completed all the 4 exercises successfully, you would have earned the following 2 digital badges.
Most importantly, you have acquired the basic skills to use simulation, analysis and measurement to learn further topics in digital electronics on your own or with your peers who have completed this course.