User Tools

Site Tools


embedded:adventures:analogio

Table of Contents

Analog Output

There are two means to create analog output. One is through a digital to analog (D/A) converter, while the other is through a high frequency digital signal. The latter method is called pulse width modulation (PWM). One form of PWM involves modulating a digital signal at a certain (high) frequency with a variable duty cycle. If the duty cycle is 0%, then the signal is always off. If the duty cycle is 100%, then it is always on. If it is at 50%, then it is a pulse train whose frequency is that of the signal. Specialized, interrupt-driven, code is required to get PWM working on microprocessors. Fortunately, today, that code is already written in a library to be used.

Returning to the former method, the old school way to control a D/A chip was through a parallel output scheme, whereby the 8- or 10- or XX-bits of output were sent directly to the chips for conversion to a single analog output signal. As microprocessors got faster, the parallel input signal was replaced with a serial input signal. The serial signal economized on pin usage. More generally, microprocessor design has been moving towards serial interfaces and away from parallel interfaces. The reason most likely has to do with shrinking chip sizes and increased functionality without significant addition to pin count. Parallel interfaces are still used on computers since they transmit data at a faster rate (on PCs buses can be 64- to 256-bits wide, maybe more as I don't keep track of the cutting edge).

Arduino

to be added.

TI

to be added.

mBed

p15 to p20 are the AnalogIn Input Pins, and p21 to p26 are the PwmOut Output Pins. This means the mBed can handle separate instances of Analog I/O devices.

This tutorial about connecting pushbuttons to a RGB LED will help.

mBed expresses its analog values from 0.0 to 1.0, floating values. If a more traditional range is preferred, there is always the option of mapping them with simple math.

embedded/adventures/analogio.txt · Last modified: 2023/03/06 10:31 by 127.0.0.1