Re: MSP430F1612: generating sinusoidal signals
- From: Paul Keinanen <keinanen@xxxxxx>
- Date: Thu, 08 Feb 2007 16:28:51 +0200
On 7 Feb 2007 19:26:11 -0800, Marius.Hancu@xxxxxxxxx wrote:
OK, I've found this reference:
DMA eases CPU's workload for waveform generation
Code uses the fewest cycles to implement periodic waveform with DACs.
Mike Mitchell, Texas Instruments, Houston, TX; Edited by Brad Thompson
and Fran Granville -- EDN, 12/5/2005
http://www.edn.com/article/CA6288034.html
Not sure if something better can be done with this processor in terms
of periodic waveform generation.
It depends what frequency accuracy / frequency step is needed and what
the spurious response requirements are.
In the beginning of that article, there was a simplistic calculation
about using a programmed approach to generate a 1 kHz sine wave using
a 32 kHz sample and interrupt rate. The waveform looks good on an
oscilloscope even without the LPF, but for audio applications, this
would be an overkill.
For audio applications just over 2-3 times the highest sine wave
frequency should be enough.
If the highest sine frequency you needed is 6 kHz, then 16 kHz might
be the suitable interrupt rate, which would be 1/2 of the interrupt
rate of the initial 32 kHz programmed case, so the load figures would
also be one half of that example.
The numerically controlled oscillator can be used to generate quite
clean waveforms with modest sampling frequencies.
In this case, for each frequency that needs to be generated, perhaps a
16 bit phase accumulator would be enough. At each interrupt, a phase
increment (depending of the frequency needed) is added to the phase
accumulator, which may freely overflow. The highest bits of the phase
accumulator (say 8 bits) are used to address the sine look-up table
and the table element value is loaded into the DAC. In this case the
frequency tuning step is 16000 Hz/65536 or 0,24 Hz and the look-up
table would contain 256 elements.
As long as the sampling frequency is not a harmonic multiple of the
sine wave frequency, different elements in the look-up table are
addressed at different cycles, so even when observing the waveform
before the LPF with an oscilloscope, after a few overlapping traces, a
clean sine wave will appear on the screen.
Of course, other phase accumulator sizes and look-up table sizes can
be used, but these involve some extra shift instructions.
In the article, the 32 kHz sampling rate with 1 MHz crystal frequency
caused 58 % load for a single output frequency, so with 16 kHz sample
rate would be above 29 %, due to the extra instructions to extract the
high bits from the phase accumulator. With 8 MHz crystal frequency,
the load would be about 4 %.
Paul
.
- References:
- MSP430F1612: generating sinusoidal signals
- From: Marius Hancu
- Re: MSP430F1612: generating sinusoidal signals
- From: Marius . Hancu
- MSP430F1612: generating sinusoidal signals
- Prev by Date: Re: MSP430F1612: generating sinusoidal signals
- Next by Date: Re: Job fairs == waste of time
- Previous by thread: Re: MSP430F1612: generating sinusoidal signals
- Next by thread: Re: MSP430F1612: generating sinusoidal signals
- Index(es):
Relevant Pages
|
Loading