74
F. Firouzi et al.
Fig. 2.15 How a simple switch circuit works
Figure 2.15 illustrates the function of a simple switch circuit. When an internal
pull-up input mode is utilized, the button circuit is active low, meaning that pushing
the button results in a “0” in logic in the input data register. If the input mode is
pull-down, a pressed button results in a “1” in logic in the input data register. To
utilize input floating, an external pull-up/pull-down resistor is needed. For instance,
when an external pull-down resistor is used, the circuit is active high, meaning that
pressing the button results in “1” in the corresponding input data register [10].
Other than GPIOs, MCUs also include circuits that handle various peripheral functions, making deployment in diverse settings easier. An MCU generally
includes at least one analog/digital converter (ADC) needed to change incoming
analog signals into digital values as well as at least one digital/analog converter
(DAC) needed to change digital values into outgoing analog signals.
2.5.3.2 Analog Inputs
Because MCUs cannot read non-digital data values, the analog input pin requires
an extra element, known as an analog-to-digital converter (ADC), to read analog
voltage and then transform it into a digital format. The ADC reads the input voltage
and then transforms it into a binary value.
ADCs can be implemented in several ways and their details are beyond the scope
of this chapter. However, it is very important to define “ADC resolution.” The ADC
resolution specifies the number of distinct values generated across the complete
range of analog values. In other words, resolution regulates the accuracy of ADC
and the magnitude of the quantization error. The ADC resolution is specified by the
number of bits it uses to digitize an analog signal. For instance, an 8-bit ADC can
encode an analog input to 1 of 256 different levels (2 8 = 256). On the other hand, in
a 16-bit ADC, the range of the analog signal is represented by 2 16 (65536) discrete
values.
Précédent

- 83/647

Suivant