Today I got a ADUC development board in our store, so I started with my task, the same task sinewave generation, reading back the sinewave and saving the sinewave samples in external ram(actually the xram is inside the chip, but it is interfaced as external). There was a crystal attached to the chip . but the crystal attached to the chip was not active by default. The system clock is decided by a internal PLL circuit and is controlled by CONFG842 sfr.
Sinewave generation with the DAC0
I had taken 6 samples per cycle which was not enough(which was simulated accurate sinewave in proteus). So I had to increase the sample rate to 36 per cycle(10 degree interval). Rest job was to read the sinewave .
Reading Sinewave normal and DMA mode
Using adc with ADUC is a bit complex at software part and simple at hardware, because you have to configure 3 sfr’s ADC1-3. The data will be written at ADCDATAH and ADCDATAL two 8bit registers. Actually ADCDATAH contains the ADC channel id at the higher 4 bit locations and the higher 4 bit of the ADCread value at the lower 4 cells. Save both the values in an integer variable.
Saving the data in RAM
The adcread values need to b saved at some location for further processing. This is better with some external RAM(XRAM), fortunately we have 2KB of external ram inside the microcontroller.
Perhaps this is the last job that I have to do for my thesis, I need some FFT calculation to get the impedance value from the samples read by ADC.
Is it simple
This is all I have to do for now. From the first stage to the last stage there are a lot of hidden problems. Getting a pure sinewave at a high frequency wwith tradeoff between frequency and sinewave shape…