Digital Logic
By digital logic we are referring to an electrical system that makes use of two distinct voltage levels to encode information.
In this case a binary system of 0's and 1's were 0 is a low voltage and 1 is a high voltage.
The 0's and 1's can be represented by switches which are either ON (1) or OFF (0) but beyond these simple actions these switches are combined to create more complex building blocks.
These building blocks are NOT, AND, OR, XOR
The NOT (negating/inverter), function when added to the output of the AND, OR & XOR creates the NAND, NOR & XNOR.
These logic functions are unidirectional meaning that changes at the input only affect the output.
All these basic functions only have one output.
The NOT gate only has one input whilst the other gates have a minimum of 2.
The NOT output from a digital logic perspective is in the opposite state to the input.
If the input is ON the output is OFF and if the input is OFF the output is ON.
Each function will be represented by symbols
Function Symbol
NOT -
AND ^
OR v
NAND ⊼
NOR ⊽
XOR ⊻
XNOR ⊙
{Multiple symbols exist for the same logic function the availability subject to fonts and whether graphics or text. This is particularly evident with the XOR/XNOR functions.}
For the other gates, combinations of the two inputs produce an output subject to the truth table
The truth table lists the input combinations and the corresponding output state.
Logic Levels
In this context we are referring to two distinct voltage states which represent the binary states of 0 and 1.
The 0 (Low = L), would be represented by a low voltage and the 1 (High = H), by a high voltage.
The voltage for the logic levels varies depending on the type of logic family.
In this case as we are using a Microbit with a supply voltage of 3.3V.
However, the inputs have logic thresholds which minimise the effect of variation in the voltage level due to finite variation in voltage accuracy and noise.
The logic input high level (VIH), is recognised as such if the input voltage is > ~1.8V*. (maximum 3.3V)
The logic input low level (VIL), is recognised as such if the input voltage is < ~1.4V*. (minimum 0V)
*Voltage levels as measured on an actual Microbit using a potentiometer to vary the input voltage.
If you are dealing with logic from the same family, logic thresholds will be compatible and can simply be reference as 0 = Low or 1 = High.
But if interfacing to different logic families the voltages become important and voltage level shifting ensures that the logic levels between the different logic families maintains correct function.
As we will be dealing purely with the Microbit no other logic families will be involved and therefore there will be no need for voltage level shifting.
Connections
he physical connections to the Microbit for the logic function use Analog inputs P0 and P1 and Digital output P2.
Enabling one or two input logic functions all with a single output.
Layout
The Microbit display is divided up into input, output and symbol area.
Button A - Selects a logic function and shows the symbol on the display.
Button B - Shows the truth table for the logic function selected with Button A
Button A+B - Enabled or disables the output at P2 whilst retaining live update at LED 4,4
Column 1 shows the inputs to the logic function with LED's at co-ordinates 0,1 (input a) & 0, 3 (input b)
Column 5 shows the status of the logic function output with LED at 4,2 (output).
When an input or output LED is lit it indicates a logic 1 (High) and when extinguished logic 0 (Low).
Columns 2 to 4 show the symbol for the selected logic function.
AND gate example:
This shows the input LED's with a logic 1 (High) at both inputs.
This shows the output LED with a logic 1 (High).
The symbol display area of 3x5 LED's shows the AND function.
Gates
NOT (Inverter)
Press button B for the truth table of the gate currently selected....
Read more »