This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CONFIGURING ADC IN 2808

hi

HOW  TO SAMPLE SAME ADC INPUT AT DIFFERENT INSTANT .

CAN ANYONE ENLIST THE SEQUENCE FOR SUCH ADC CONFIGURATI

  • Waseem,

    Waseem Ahmad said:

    HOW  TO SAMPLE SAME ADC INPUT AT DIFFERENT INSTANT .

    CAN ANYONE ENLIST THE SEQUENCE FOR SUCH ADC CONFIGURATI

    You will need to provide more information, as I don't understand your question.  You want to sample the ADC input at a different instant from what?  How many channels are you trying to sample?  What sample rate?  What is the triggering event (e.g., ePWM timer, external SOC pin, etc.)?
    Regards,
    David
  • Hi David
    I have to sample only one channel. I need four samples of input within a PWM cycle i.e. at t=0, period , at CMPA increasing and decreasing. . triggering event could be epwm timer . I am writing the code which i have written but not working.
    Regards
    Waseem


    AdcRegs.ADCMAXCONV.all = 0x0003;

    AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x3; // Setup ADCINA3
    AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x3; // Setup ADCINA3


    AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x3; // Setup ADCINA3
    AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x3; // Setup ADCINA3

    AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
    AdcRegs.ADCTRL2.bit.EPWM_SOCB_SEQ2= 1;// Enable SOCB from ePWM to start SEQ2



    // to trigger adc soc on cmpa

    EPwm6Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
    EPwm6Regs.ETSEL.bit.SOCASEL = 4; // Select SOC from from CPMA on upcount
    EPwm6Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
    EPwm6Regs.CMPA.half.CMPA = 3000; // Set compare A value
    EPwm6Regs.TBPRD = 5000; // Set period for ePWM1
    EPwm6Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;



    // to trigger adc soc on zero


    EPwm5Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
    EPwm5Regs.ETSEL.bit.SOCASEL =1; // Select on zero
    EPwm5Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
    EPwm5Regs.TBPRD = 5000; // Set period for ePWM1
    EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;


    //to trigger adc soc on cmpa decreasing

    EPwm6Regs.ETSEL.bit.SOCBEN = 1; // Enable SOC on B group
    EPwm6Regs.ETSEL.bit.SOCBSEL = 5; // Select SOC WHEN CCPMA on downcount
    EPwm6Regs.ETPS.bit.SOCBPRD = 1;// Generate pulse on 1st event



    //to trigger adc soc on period


    EPwm5Regs.ETSEL.bit.SOCBEN = 1; // Enable SOC on B group
    EPwm5Regs.ETSEL.bit.SOCBSEL = 2; // Select SOC WHEN COUNTER IS period
    EPwm5Regs.ETPS.bit.SOCBPRD = 1;// Generate pulse on 1st event


    //to trigger generate pwm interupt on zero

    EPwm5Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO; // Select INT on Zero event
    EPwm5Regs.ETSEL.bit.INTEN = 1; // Enable INT
    EPwm5Regs.ETPS.bit.INTPRD = 0x1;







    for(;;)
    {
    asm(" NOP");

    }


    }


    interrupt void epwm5_timer_isr(void)
    {


    sam_2=AdcRegs.ADCRESULT0; //ADCINA3 reault on cmpa
    sam_1=AdcRegs.ADCRESULT1; //ADCINA3 reault on aero
    sam_4=AdcRegs.ADCRESULT4; //ADCINA3 reault on cmpa decreasing
    sam_3=AdcRegs.ADCRESULT5; //ADCINA3 reault on period
  • i need to sample same voltage at different instant 

    Here is a diagram explaining what i needed to achieve.