Greetings! There is no answer from TI, so I need a little bit of help here! How can I select and convert data from one of the PGA inputs of F280041C? There is only 1 example into the lib -> pga_ex1_dac_adc_ext_loopback. So I`m using similar code, but I can`t get where I can change the read PGA input from. Here are parts my code:
#define MY_ADC_BASE ADCB_BASE
/*PGA enable I suppos*/
void initPGA(void)
{
//
// Set a gain of 3 to PGA2
//
PGA_setGain(PGA2_BASE, PGA_GAIN_3);
//
// No filter resistor for output
//
PGA_setFilterResistor(PGA2_BASE, PGA_LOW_PASS_FILTER_DISABLED);
//
// Enable PGA2
//
PGA_enable(PGA2_BASE);
}
/*ADCSOC init*/
void initADCSOC(void)
{
//
// Configure SOC0. The temperature sensor is internally connected to B14
// and requires an acquisition time of at least 450 ns.
//
ADC_setupSOC(MY_ADC_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
ADC_CH_ADCIN1, 45);
ADC_setupSOC(MY_ADC_BASE, ADC_SOC_NUMBER1,
ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN1, 45);
//
// Set SOC0 to set the interrupt 1 flag. Enable the interrupt and make
// sure its flag is cleared.
//
ADC_setInterruptSource(MY_ADC_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
ADC_enableInterrupt(MY_ADC_BASE, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1);
}
/*my main loop*/
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER0);
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER1);
//
// Force ADC conversion
//
for(;;)
{
if(ADC_getInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1))
{
//
// Acknowledge flag
//
ADC_clearInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1);
dacResult = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER0);
pgaResult = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER1);
//pgaGain = (float)pgaResult / (float)dacResult;
//
// Force ADC conversion
//
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER0);
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER1);
}
}
In this case I`m receiving floating value for pgaResult and it doesn`t seem to change acording the value of any PGA input!
Any ideas?
Thanks!