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.

ADC Conversion 28377D setup



Hi there,

Can someone explain in simple terms what is the meaning of the lines (in bold) at the end of this adc configuration example? are they strictly related to the interrupt generation?

void ConfigureADC_B(void)
{
EALLOW;

//write configurations
AdcbRegs.ADCCTL2.bit.PRESCALE = 6; // (6h=0110b) set ADCCLK divider to INPUT CLOCK /4
AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);

//Set pulse positions to late
AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;

//power up the ADC
AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;

//delay for 1ms to allow ADC time to power up
DELAY_US(1000);

EDIS;
}

 

void SetupADC_B(Uint16 channel)
{
Uint16 acqps;

//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcbRegs.ADCCTL2.bit.RESOLUTION){
acqps = 19; //(19->100ns, 14->75ns)
}
else { //resolution is 16-bit
acqps = 63; //320ns
}

//Select the channels to convert and end of conversion flag
EALLOW;
AdcbRegs.ADCSOC4CTL.bit.CHSEL = 4; //***SOC4 will convert pin B4

AdcbRegs.ADCSOC4CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles
AdcbRegs.ADCSOC4CTL.bit.TRIGSEL = 0;

AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 4; //end of SOC4 will set INT1 flag (ADCINT1 EOC Source Select)

AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; //enable INT1 flag
AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared
}

Thank you so much

Leo