In digital electronics, a signal can only have two states ON or OFF. While the signal can be encoded, stored and processed as this article will show, fundamentally there are those two logic level states. Logic level refers to a specific voltage or state where a digital signal exists.
Taking this into consideration, hardware ranging from microcontroller ICs to sensors and LEDs will be configured to use these logic levels during operation. In the most basic form, they will be Active-Low or Active-High which means they will be activated when the digital signal is at a certain logic level as the graph below shows:
The signal will need to be capable of switching from one state to the other, when this switching takes place there will be a period where the signal is in an invalid state, neither HIGH or LOW. An invalid state can be unpredictable as it is often equivalent to leaving a pin floating removing the certainty of a pin state. Therefore it is important to quantify this period. Rising Edge refers to a signal changing from state LOW to state HIGH, falling edge refers to the signal changing from state HIGH to state LOW.
Pulse Width Modulation Introduction
PWM, Pulse Width Modulation is a control technique that use logic levels to encode instructions. PWM works by pulsing a digital signal and varying the amount of time that each pulse is in a HIGH state / LOW state. These pulse durations will then be interpreted as a certain instruction by the hardware. This method allows the average power delivered by an electric signal to be reduced improving the overall system efficiency while also simplifying the control of hardware without the need of complex software algorithms. The period of the pulses can be quantified using the duty cycle value, duty cycle is the amount of time the signal pulse is high compared to the amount of time it is low. A 0% duty cycle PWM signal will be a continuous LOW signal whereas a 100% PWM duty cycle signal will be a continuous HIGH signal.
Logic Level Implementations
Theoretically as shown above, there are only the HIGH and LOW logic levels however there are different practical ways to implement this. A common method used are TTL Levels which typically range from 0V to either 3.3V or 5V. TTL means Transistor-Transistor Logic and occurs when a system uses bipolar transistors to switch and maintain logic states. This method relies on threshold voltage levels to operate successfully:
- VOH — Minimum OUTPUT Voltage level a TTL device will provide for a HIGH signal.
- VIH — Minimum INPUT Voltage level to be considered a HIGH.
- VOL — Maximum OUTPUT Voltage level a device will provide for a LOW signal.
- VIL — Maximum INPUT Voltage level to still be considered a LOW.
The space between VOH and VIH is the noise margin, to prevent noise pushing the signal interpretation into an invalid state.
Originally the standard for TTL logic levels was 5V, to improve power consumption by reducing the base operating voltage to 3.3V, the V CMOS technique was developed. This logic level system was designed to be bidirectionally compatible with 5V devices as long as the 3.3V device pins are 5V tolerant. As an example, a logic HIGH on a 3.3V signal will be above 2,4V, this is above the VIH of 2V of the 5V device so both devices interpret this as a logic HIGH signal .
Another common logic level standard are the Arduino logic levels (5 V CMOS) which reduces the invalid region between logic LOW and logic HIGH improving the noise margin by creating a larger threshold for the LOW signals. This improves the robustness of the overall system allowing more complex implementations and applications.
Logic Gates (diagrams + truth tables)
A logic gate is an elementary building block of a digital circuit. In general, logic gates have one output and up to two inputs. The terminals are always in one of the two binary states: low (0) or high (1).
Digital systems are built using a combination of different logic gates. The basic logic gate operations and their truth tables are described below.