Part Number: TMS320F280041C
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE
This is related to the query
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
//