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.

TMS320F280041C: ADC Configuration

Part Number: TMS320F280041C
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

This is related to the query

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/919360/ccs-tms320f280041c-adc-input-channel-selection

So I understood that we have to define the channel in order to use the particular pin of A0 or whatever

But now my question is where do you define it...

ADC_INT_NUMBER1 = 0U,

I know there is a command to define the channel, but the problem is I never really understood where it is being defined. The sample program for F28x4x series is using A0 channel in all of the examples. I want to know how can i change the address of the channels for the ADC

I am attaching the sample program from the ADC for your reference can you please tell me exactly where it is being defined.


ERT

//###########################################################################
//
// FILE:   adc_ex8_ppb_limits.c
//
// TITLE:  ADC limits check using post-processing block for f2838x.
//
//!
//! This example sets up the ePWM to periodically trigger the ADC. If the
//! results are outside of the defined range, the post-processing block
//! will generate an interrupt.
//!
//! The default limits are 1000LSBs and 3000LSBs.  With VREFHI set to 3.3V, the
//! PPB will generate an interrupt if the input voltage goes above about
//! 2.4V or below about 0.8V.
//!
//! \b External \b Connections \n
//!  - A0 should be connected to a signal to convert
//!

void main(void)
{

}

//
// configureEPWM - Setup SOC and compare values for EPWM
//
void configureEPWM(uint32_t epwmBase)
{
    //
    // Disable SOCA trigger
    //
    EPWM_disableADCTrigger(epwmBase, EPWM_SOC_A);

    //
    // Trigger SOCA on CMPA up-count
    //
    EPWM_setADCTriggerSource(epwmBase, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);

    //
    // Generate pulse on 1st event
    //
    EPWM_setADCTriggerEventPrescale(epwmBase, EPWM_SOC_A, 1U);

    //
    // Set compare A value to 2048 counts
    //
    EPWM_setCounterCompareValue(epwmBase, EPWM_COUNTER_COMPARE_A, 2048U);

    //
    // Set period to 4096 counts
    //
    EPWM_setTimeBasePeriod(epwmBase, 4096U);

    //
    // Freeze counter
    //
    EPWM_setTimeBaseCounterMode(epwmBase, EPWM_COUNTER_MODE_STOP_FREEZE);
}

//
// adcAEvtISR - ISR for ADCA PPB
//
interrupt void adcAEvtISR(void)
{
    //
    // Warning, you are outside of PPB limits
    //
    intStatus = ADC_getPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1);
    if((intStatus & ADC_EVT_TRIPHI) != 0U)
    {
        //
        // Voltage exceeded high limit
        //
        asm("   ESTOP0");

        //
        // Clear the trip flag and continue
        //
        ADC_clearPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPHI);
    }
    if((intStatus & ADC_EVT_TRIPLO) != 0U)
    {
        //
        // Voltage exceeded low limit
        //
        asm("   ESTOP0");

        //
        // Clear the trip flag and continue
        //
        ADC_clearPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPLO);
    }
    Interrupt_clearACKGroup(INT_myADC0_EVT_INTERRUPT_ACK_GROUP);
}

//
// End of file
//

  • Hi Faiz,

    If you are using the old version of C2000Ware (3_04_00_00), there is a function n main that is called configureADCSOC(ADCA_BASE, 0).  This is where you can change the channel.  Since it is using ADCA_BASE and next argument is 0, the function is set up to use A0.  If you are using a more recent version of C2000Ware (4_00_00_00), you have to use SysConfig tool to set up the channel from the GUI interface.

    Regards,

    Joseph