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/TMS320F28379D: tms320f28379d

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

In the following code how the value of channel is updated and what is the meaning of ''void SetupADCContinuous(Uint16 channel)'' passing channel as a variable instead of l... please suggest

void SetupADCContinuous(Uint16 channel)
{
Uint16 acqps;

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

EALLOW;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC1CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC2CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC3CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC4CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC5CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC6CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC7CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC8CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC9CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC10CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC11CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC12CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC13CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC14CTL.bit.CHSEL = channel; //SOC will convert on channel
AdcaRegs.ADCSOC15CTL.bit.CHSEL = channel; //SOC will convert on channel

AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC3CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC4CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC5CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC6CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC7CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC9CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC10CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC11CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC12CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC13CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC14CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles
AdcaRegs.ADCSOC15CTL.bit.ACQPS = acqps; //sample window is acqps +
//1 SYSCLK cycles

AdcaRegs.ADCINTSEL1N2.bit.INT1E = 0; //disable INT1 flag
AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; //disable INT2 flag
AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; //disable INT3 flag
AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; //disable INT4 flag

AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;

AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 6; //end of SOC6 will set INT1 flag
AdcaRegs.ADCINTSEL1N2.bit.INT2SEL = 14; //end of SOC14 will set INT2 flag
AdcaRegs.ADCINTSEL3N4.bit.INT3SEL = 7; //end of SOC7 will set INT3 flag
AdcaRegs.ADCINTSEL3N4.bit.INT4SEL = 15; //end of SOC15 will set INT4 flag

//
//ADCINT2 will trigger first 8 SOCs
//
AdcaRegs.ADCINTSOCSEL1.bit.SOC0 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC1 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC2 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC3 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC4 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC5 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC6 = 2;
AdcaRegs.ADCINTSOCSEL1.bit.SOC7 = 2;

//
//ADCINT1 will trigger second 8 SOCs
//
AdcaRegs.ADCINTSOCSEL2.bit.SOC8 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC9 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC10 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC11 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC12 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC13 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC14 = 1;
AdcaRegs.ADCINTSOCSEL2.bit.SOC15 = 1;
EDIS;
}