MCU offers inexpensive analogue-to-digital conversion

Article By : Charles Small

This versatile conversion circuit detects and displays signal's peak value. It offers a low-cost analogue-to-digital conversion and a three-digit, seven-segment display.

A previous article showed how to utilise shift registers to increase a microcontroller's output capabilities (Reference 1). This expanded design idea provides low-cost analogue-to-digital conversion and a three-digit, seven-segment display. Although applicable to other microcontrollers, the circuit in the figure uses a Microchip PIC12F675 controller and three multiply sourced 74AC164 serial-input/parallel-output shift registers.

[EDNAOL 2016JUN06 AN 02Fig]*Figure: A low-cost microcontroller captures an analogue voltage, converts it to a peak reading, and displays the results in decimal format on LED displays.
*

The circuit accepts incoming signals of 0 to 5V. The microcontroller, IC1, performs the analogue-to-digital conversion and subsequently converts the binary-voltage value to BCD (binary-coded-decimal) format. Next, the microcontroller converts the BCD values to hardware-specific seven-segment-display masks and shifts the masks to the 74AC164 registers, IC2 through IC4, which in turn drive the seven-segment displays.
Listing 1 implements an additional function. Instead of displaying each input value as it's converted, the microcontroller operates as a peak detector. When the maximum value changes, the microcontroller updates the three-digit display. A pushbutton switch, S1, resets the maximum value. You can modify the code to apply other functions to the input data and calculate and display the data in other formats. In addition, you can modify the interrupt-driven conversion process to accommodate different sampling rates. When you modify the sampling rate or the ISR (interrupt-service routine), ensure that the ISR completes execution within a single sample period.

Reference
Raynus, Abel, "Squeeze extra outputs from a pin-limited micro-controller,"EDN, Aug 4, 2005, pg 96.

This article is a Design Idea selected for re-publication by the editors. It was first published on May 10, 2007 in EDN.com.

Virtual Event - PowerUP Asia 2024 is coming (May 21-23, 2024)

Power Semiconductor Innovations Toward Green Goals, Decarbonization and Sustainability

Day 1: GaN and SiC Semiconductors

Day 2: Power Semiconductors in Low- and High-Power Applications

Day 3: Power Semiconductor Packaging Technologies and Renewable Energy

Register to watch 30+ conference speeches and visit booths, download technical whitepapers.

Subscribe to Newsletter

Leave a comment