EDN logo


Design Ideas: September 15, 1994

Simple algorithm nulls dc offsets in DSP

V Solovyov,
Rossiya, Russia

One problem associated with converting analog signals to digital samples is ensuring that the zero level of an analog signal (minus its dc offset, if any) converts to a digital sample of exactly zero. If the analog signal's zero level does not convert exactly, the converted samples retain a residual dc component, complicating processing.

The test program in XASM-3 in Listing 1 for the TI TMS320C10 DSP µP provides a simple means for nulling residual dc out of digitized samples. You can easily insert this low-overhead test program into your DSP routines.

The routine continuously sums the incoming digitized samples. The routine temporarily turns off the DSP µP's saturation mode. Thus, the DSP µP's accumulator works as an integrate-and-dump device. Because of this integration, the routine can measure small dc offsets in the digitized signal against the background of the relatively large total signal. Sometimes, the dc offset in input signal depends on the total analog signal, so measuring the dc offset in the presence of the total input is best. Integration also cancels interference and noise.

The routine dumps the total in the accumulator to an external D/A converter that you must supply. This D/A converter and an oscilloscope let you observe the value of the number periodically dumped on an oscilloscope. The oscilloscope and D/A converter are well worth their extra time and expense because they provide invaluable help when you null the dc offset from your DSP system.

Fig 1 shows the two displays such a setup can produce. The displays correspond to the dc offset's being larger than zero or smaller than zero. To "tune" your DSP routine, adjust your circuit's analog bias voltage to make the sawtooth wave's period as long as possible. When the sawtooth's period is as long as possible, the residual dc component in the digitized samples becomes as small as possible.

This equation relates the stray dc component in the digitized samples, [delta]V, to the sawtooth wave's period:

DeltaV=232 SHIFT/(K×T×FS),

where Fis the sampling rate, K is the ADC's voltage-to-number conversion coefficient, and SHIFT is the SHIFT parameter in the listing. 8 For example, a sampling rate of 100k samples/sec, an input-voltage amplitude of 1.5V, and a SHIFT value of 11 allow you to evaluate δV to 10-mV accuracy and view sawtooth waveforms having about a 0.1-sec period.

In the listing, the program uses all 32 bits of the DSP µP's accumulator. The SHIFT parameter in the ADD S,11 instruction increases the effect of the integration, making the evaluation more accurate but simultaneously increasing the observed signal's period, impeding the observation.


| EDN Access | feedback | subscribe to EDN! |
| design features | design ideas | columnist |


Copyright © 1995 EDN Magazine. EDN is a registered trademark of Reed Properties Inc, used under license.