Knowledge Base
Fundamentals
Introduction To IO
5 min
lead in all interaction with a microcontroller is performed using i/o, or inputs and outputs io may, in its simplest form be a single pin which is configured as either an input or an output they are generally grouped into two types digital , where the input/output value is either a 1 or 0, high or low no specialized signal conversion is usually required for a number value of the i/o to be obtained analog , where the input or output voltage represents a value and that value is converted into a digital or numerical value for it to be useful as either an input or an output digital io digital io exists between two states, either high or low represented by a binary 1 or 0 when configured as an input, the signal changes between these two states signaling to the micro that an input has been received the microcontroller is aware of the change in one of two ways the input is read at a regular interval or an interrupt signals to the mcu that a change has taken place when configured as an output, the mcu then sets or clears the output the term set refers to when it is 1 and clear refers to when it is zero caution must be exercised when working with io because the logical versus the physical implementation can have consequences that cause injury for further details please see the section working with digital io the code programmed into the device will determine when the output is activated, why, and for how long analog io for most microcontrollers, analog io is an input a simple variable resistor can be your signal source, and the microcontroller then reads that changing value converting it into a numerical value for the input voltage to be read and converted into a numerical value, an analog digital converter is required many microcontrollers have this as an internal peripheral which makes it easier to use however, depending on the requirement, an external adc may be interfaced with the microcontroller as well when the microcontroller is required to perform the reverse, a digital to analog conversion takes place and a digital to analog converter is required the resolution of the accuracy of the dac is indicated by the number of bits it can process to produce the output the same applies to the dac, in that more microcontrollers now have the peripheral available internally however, depending on the requirements, an external dac may be interfaced with the microcontroller as well external dac may introduce high performance, high resolution capability to an application ensure to check on the device's datasheet whether one has been included the acronym dac is often used the topic of analogs is a very in depth and multifaceted discussion please see the section working with analogs