- •1 Microcontroller Basics
- •1.1 Introduction
- •1.2 Frequently Used Terms
- •1.3 Notation
- •1.4 Exercises
- •2 Microcontroller Components
- •2.1 Processor Core
- •2.1.1 Architecture
- •2.1.2 Instruction Set
- •2.1.3 Exercises
- •2.2 Memory
- •2.2.1 Volatile Memory
- •2.2.3 Accessing Memory
- •2.2.4 Exercises
- •2.3 Digital I/O
- •2.3.1 Digital Input
- •2.3.2 Digital Output
- •2.3.3 Exercises
- •2.4 Analog I/O
- •2.4.1 Digital/Analog Conversion
- •2.4.2 Analog Comparator
- •2.4.3 Analog/Digital Conversion
- •2.4.4 Exercises
- •2.5 Interrupts
- •2.5.1 Interrupt Control
- •2.5.2 Interrupt Handling
- •2.5.3 Interrupt Service Routine
- •2.5.4 Exercises
- •2.6 Timer
- •2.6.1 Counter
- •2.6.2 Input Capture
- •2.6.3 Output Compare
- •2.6.4 Pulse Width Modulation
- •2.6.5 Exercises
- •2.7 Other Features
- •2.7.1 Watchdog Timer
- •2.7.2 Power Consumption and Sleep
- •2.7.3 Reset
- •2.7.4 Exercises
- •3 Communication Interfaces
- •3.1 SCI (UART)
- •3.3.1 Data Transmission
- •3.3.2 Speed Control Through Slave
- •3.3.4 Extended Addresses
- •3.4 Exercises
- •Index
2.4. ANALOG I/O |
51 |
generally offers one or more different gains, but possibly not for all channels. The resulting output code for gain G is given by
$ |
V· |
|
GND |
· |
% |
|
|
G |
(V+ − V−) |
|
2r−1 + 0.5 , |
(2.6) |
|
|
|
|
||||
|
|
ref − |
|
|
|
|
where G · (V+ − V−) [−Vref /2, Vref /2].
2.4.4Exercises
In the following exercises, we assume that GND = 0V.
Exercise 2.4.1 Assume that you have an 8-bit ADC with Vref = 5V. What is the granularity of the converter (1 lsb)?
Exercise 2.4.2 Assume that you have an 8-bit ADC with Vref = 5V. Which input voltages are mapped to the code word 0x00? Which voltages are mapped to 0xFF?
Exercise 2.4.3 Assume that you have an 8-bit ADC with Vref = 5V. If the input voltage is 3.5V, what is the resulting code word?
Exercise 2.4.4 Assume that you have an 8-bit ADC with Vref = 5V and bipolar operation. If the inputs are V+ = 1V and V− = 2V, what is the resulting code word? What is the resulting code word if we use unipolar mode?
Exercise 2.4.5 You have an 8-bit ADC with Vref = 5V and a differential input channel. The positive input voltage V+ is in the range [0.99, 1.03]V, the negative voltage V− is within [1.02, 1.025]V. What is the input range of the resulting differential input? What percentage of the full input range does that cover? How large is the quantization error, in percent of the differential input range?
Exercise 2.4.6 Consider the previous exercise. If the ADC offers the gains {2, 5, 10, 20, 50, 100, 200}, which gain would you select? How does your selected gain affect the quantization error (again in percent of the differential input range)?