AnsweredAssumed Answered

ADUC7023: How to use ADCDAT samples and feed into DAC for analog output?

Question asked by Linc on Mar 9, 2014
Latest reply on Mar 17, 2014 by Linc

From the two attached files, I am trying to take the ADCDAT digital value and feed it into the DAC to convert back to analog signal. Any thoughts if this will work?

 

#include <aduc7023.h>

unsigned int uiPLLTST = 0;

 

void ADCpoweron(int);

void delay(int);

 

int main(void)

{

    unsigned short ADCDATA[32];

    int j;

   

    // Table is placed in Flash/EE

    unsigned short TableS[64];

    unsigned char i = 0;

   

    POWKEY1 = 0x01;                    // Configure CPU Clock for 41.78MHz, CD=0

     POWCON = 0x00;

     POWKEY2 = 0xF4;   

 

    ADCpoweron(20000);                // power on ADC

    ADCCP = 0x00;                      // select ADC channel 0

    REFCON = 0x01;                    // internal 2.5V reference. 2.5V on Vref pin

    ADCCON = 0xEE4;                    // ADC Config: fADC/8, acq. time = 8 clocks

   

    REFCON = 0x01;

    DAC0CON = 0x12;              

   

    while (1)

    {

          // start continuous conversion

        for (j=0; j <32; i++)

        {

        while (!ADCSTA){}            // wait for end of conversion

        ADCDATA[j] = (ADCDAT >> 16);

        TableS[i] = ADCDATA [j];

       

        delay(100000)  // I am still working to figure out how to implement the delay while the DAC conversion is in progress.

        DAC0DAT = (TableS[i] << 16);

        }       

    }               

}

 

void ADCpoweron(int time)

{

    ADCCON = 0x20;                         // power-on the ADC

    while (time >=0)                      // wait for ADC to be fully powered on

    time--;

}

 

void delay (int dac)

{

}

Attachments

Outcomes