Back to the 2025 paper

Module 3: Embedded Microcontrollers – PIC18F / Others

20257m

Describe the working of ADC and DAC in a microcontroller system with examples.

Worked SolutionAI Assisted

Solution: ADC and DAC in a Microcontroller System

ADC: Analog-to-Digital Converter

An ADC converts an analog voltage into a digital code that a microcontroller can process.

Working

Analog Sensor → Signal Conditioning → ADC → Digital Code → CPU
  1. The analog signal is applied to the ADC input.
  2. The ADC samples the signal.
  3. The input range is divided into discrete levels.
  4. The nearest digital code is generated.
  5. The microcontroller reads the code and converts it into engineering units.

For an ideal nn-bit ADC with input range VFSV_{FS}:

LSB=VFS2nLSB = \frac{V_{FS}}{2^n}

Approximately, the ADC code is:

CodeVinVFS(2n1)Code \approx \frac{V_{in}}{V_{FS}}(2^n-1)

Example

For a 10-bit ADC with 0–5 V input:

LSB51024=4.883 mVLSB \approx \frac{5}{1024}=4.883\text{ mV}

DAC: Digital-to-Analog Converter

A DAC converts a digital number generated by the microcontroller into an analog voltage or current.

CPU → Digital Code → DAC → Analog Voltage → Actuator

For an ideal nn-bit voltage DAC with reference VrefV_{ref}:

VoutCode2n1VrefV_{out}\approx\frac{Code}{2^n-1}V_{ref}

The exact transfer equation depends on the DAC architecture and datasheet conventions.

Applications

  • ADC: temperature, pressure, light and biomedical sensors.
  • DAC: waveform generation, motor control references, audio and analog actuator control.

ADC vs DAC

Feature ADC DAC
Conversion Analog → Digital Digital → Analog
Input Voltage/current Digital code
Output Digital code Analog voltage/current
Use Measurement Control/output generation

Conclusion

ADC enables the microcontroller to measure the physical world, while DAC enables it to generate controlled analog outputs.

Similar questions