Section 5.4 Electrical Characteristics
It is important to understand the electrical characteristics of I/O pins in order to interface external devices with the microcontroller properly. The two characteristics of primary concern are voltage-level compatibility and current-level compatibility.
Subsection 5.4.1 Voltage-Level Compatibility
To ensure that the voltage levels of external devices are able to properly interface with the ATmega328P, the voltages required for a logic HIGH and logic LOW must be known for both devices. (The values for the ATmega328P can be found in the Common DC Characteristics section of the datasheet.) The following four voltages must be compared and checked for compatibility:
-
Input HIGH voltage (\(V_{IH}\)): This is the voltage level that is treated as a logic 1 when applied to the input of a device.
-
Input LOW voltage (\(V_{IL}\)): This is the voltage level that is treated as a logic 0 when applied to the input of a device.
-
Output HIGH voltage (\(V_{OH}\)): This is the output voltage level when a digital circuit outputs a logic 1. The output HIGH voltage of circuit X must be greater than or equal to the input HIGH voltage of circuit Y, in order for circuit X to properly drive circuit Y.
-
Output LOW voltage (\(V_{OL}\)): This is the output voltage level when a digital circuit outputs a logic 0. The output LOW voltage of circuit X must be less than or equal to the input LOW voltage of circuit Y, in order for circuit X to properly drive circuit Y.
Subsection 5.4.2 Current-Level Compatibility
In order for the ATmega328P to properly drive external devices, the current drive capability must be understood. The ATmega328P is capable of supplying current when the output voltage is HIGH (current flows from the microcontroller to the device), or sinking current when the output level is LOW (current flows from the device to the microcontroller).
Each I/O pin on the ATmega328P is capable of sourcing and sinking 40Â mA. The maximum current rating of the microcontroller is 200Â mA. All logic devices have four current values that are involved in determining how much current is necessary to properly derive the device:
-
Input HIGH current (\(I_{IH}\)): This is the input current that must flow into the input pin to create a HIGH logic level.
-
Input LOW current (\(I_{IL}\)): This is the input current that must flow out of the input pin to create a LOW logic level.
-
Output HIGH current (\(I_{OH}\)): This is the output current that flows out of the output pin when the output logic level is HIGH.
-
Output LOW current (\(I_{OL}\)): This is the output current that flows into the output pin when the output logic level is LOW.
