Design Article

Writing software drivers for analog to digital converters

Mark Thoren and Leo Chen, Linear Technology Corp.

6/9/2009 12:00 AM EDT

Analog to digital converters (ADCs) provide an embedded controller's window into the analog world. A properly chosen ADC can eliminate a board's worth of op amps and adjustment potentiometers, resulting in a clean, robust design.

The design process involves making sure that the analog requirements of the circuit are met, and that the processor can do something useful with the ADC's output data; the glue between the two is the low-level driver code.

Analog to digital converters require special consideration when writing firmware, when compared with purely digital peripherals such as memory, UARTs and I/O expanders. If an ac signal is to be analyzed, the timing of the start of the conversion must be absolutely deterministic and free from software-induced jitter, placing strict requirements on how the controller initiates a conversion.

High-resolution ADCs for dc measurements may have a conversion time that is significantly longer than any other process that the controller has to perform. And lastly, the digital interface may not be a perfect match to the controller's built in peripheral controllers.

This article describes a step-by-step approach to writing a driver for a 24-bit, delta-sigma ADC with an I2C interface.(1) It illustrates many of the subtleties of driver design for a number of reasons:

• The conversion time is very long compared with most things that happen in a microcontroller.

• It uses an I2C interface, which is built into many controllers, but each controller has its own specific implementation.

• The I2C interface itself is used to indicate the status of a conversion, rather than a status bit.

• It has multiple input channels, requiring proper sequencing in firmware.

ADC details
An ADC has to do two things--take an analog measurement and send the data to a controller. These can occur simultaneously, depending on the ADC architecture. For example, the LTC2366 (a 12-bit ADC) uses the serial data clock to advance the conversion.(2) This makes sense for a high-speed part; the more operations you can do at the same time, the faster you can sample. But the ADC described here uses a delta-sigma architecture to achieve precision DC specifications, and a long conversion time (145 milliseconds) is a consequence.


Next:




JonPearson

6/11/2009 9:29 PM EDT

Hi Leo, nice article.

Cheers,
Jon Pearson
Cypress Semiconductor Corp.

Sign in to Reply



prachanda.punda

2/8/2012 5:26 AM EST

good work you have done

Sign in to Reply



Please sign in to post comment

Navigate to related information

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)