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.

CCS/UCD3138PFCEVM-026: SLUA708 PWR026_PFC

Part Number: UCD3138PFCEVM-026

Tool/software: Code Composer Studio

This Application Report says that Standard Interrupt Loop and it includs ADC measurements.

Are there any codes correspond to the "ADC measurements" in PWR026_PFC 's profile standard_interrupt.c or in other profiles? 

Please solve my problem.

  • Hello,

    You can find the adc result reading:

    void poll_adc(void)
    {
    if(AdcRegs.ADCSTAT.bit.ADC_INT == 1)
    {
    iv.adc_raw[0] = AdcRegs.ADCRESULT[0].all;
    iv.adc_raw[1] = AdcRegs.ADCRESULT[1].all;
    iv.adc_raw[2] = AdcRegs.ADCRESULT[2].all;
    iv.adc_avg[0] = AdcRegs.ADCAVGRESULT[0].all;
    iv.adc_avg[1] = AdcRegs.ADCAVGRESULT[1].all;
    iv.adc_avg[2] = AdcRegs.ADCAVGRESULT[2].all;
    #if ((EMETER_EN==ON)&&(PFC_TYPE == SINGLE_PHASE))
    iv.adc_raw[3] = AdcRegs.ADCRESULT[3].all;
    iv.adc_avg[3] = AdcRegs.ADCAVGRESULT[3].all;
    #endif
    iv.vbus_filtered = iv.adc_raw[VBUS_CHANNEL] + iv.vbus_filtered - (iv.vbus_filtered >> 6);//Q18

    //for EMI and IPM compensation
    iv.cir_buff[iv.cir_buff_ptr] = iv.vin_raw; // Care
    //iv.cir_buff[iv.cir_buff_ptr] = iv.vin_filtered;


    iv.emi_pointer = (iv.cir_buff_ptr - iv.emi_buff_delay) & 0x3f; //get pointer to delayed signal
    iv.ipm_pointer = (iv.cir_buff_ptr - iv.ipm_buff_delay) & 0x3f; //get pointer to delayed signal
    iv.cir_buff_ptr = (iv.cir_buff_ptr + 1) & 0x3f;

    AdcRegs.ADCCTRL.bit.SW_START = 1; //trigger sweep
    }

    }

    But you need initialize the ADC related registers:

    void init_adc_polled(void)
    {
    AdcRegs.ADCCTRL.bit.MAX_CONV = NUMBER_OF_ADC_CHANNELS_ACTIVE - 1;
    AdcRegs.ADCCTRL.bit.SAMPLING_SEL = 6;//268KS/s

    #if ((EMETER_EN==ON)&&(PFC_TYPE == SINGLE_PHASE))
    PMBusRegs.PMBCTRL3.bit.IBIAS_A_EN = 0;//disable current source
    PMBusRegs.PMBCTRL3.bit.IBIAS_B_EN = 0;

    //for IPM board#1 (modified)
    AdcRegs.ADCSEQSEL0.bit.SEQ0 = 3; //Vbus
    AdcRegs.ADCSEQSEL0.bit.SEQ1 = 0; //Vac_L
    AdcRegs.ADCSEQSEL0.bit.SEQ2 = 4; //Vac_N
    AdcRegs.ADCSEQSEL0.bit.SEQ3 = 2; //Iac

    .......

    }

    Regards,

    Sean

  • Thanks for your help!