Friday, 13 June 2014

dac - How to make desired waveforms by AD5668?


In another thread I asked about making sawtooth wave form via harmonics ( Here ) and someone suggested using AD5668 (octal DAC ). I looked at its datasheet but couldn't understand how it can make a wave form. Can any one help me by making a suggestion/tutorial or something?



Answer



I was the one who suggested the device to the OP in the other thread.


AD5668 is an Octal, 16-Bit SPI Voltage Output DAC with 5 ppm/°C On-Chip Reference. You need to select a sampling frequency first that is several times more than the frequency of the target signal. You can then just drive the DAC, using an SPI interface, with a pre-populated set of samples.


What I did, in order to generate an waveform, is that I wrote a general purpose function, that just adds the magnitude of respective harmonic components to the fundamental, along with phase information. This generates the array that is used to drive the DAC. The timer that is used to do the periodic SPI, is configured to control the fundamental frequency.


I just wrote some code to prototype the same. The function call to generate the array, for example, for a saw-tooth waveform is


GenSamplesHarmonics(20000,0,10000,180,6666,0,5000,180,4000,0,3333,180,2856,0,2500,180,2222,0,2000,180,1818,0,1666,180,1538,0,1428,180,1332,0);

I'll just try to explain:



A Saw-tooth wave is essentially all harmonics at amplitude 1/n, even harmonics negative. The fundamental amplitude is 20000(arbitrarily chosen). The next argument is the phase relationship with the fundamental(obviously zero in this case). Each subsequent argument pair is the 1/n of the fundamental, with each alternate pair 180 degrees out of phase.


Hope that helps.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...