I changed the continuous adc example of piccolo control stick
to adconvert only 2 inputs
the source below compiles without error but when I load and run the program
CCS crashes - why ?
==========================================
InitAdc(); // For this example, init the ADC
// Step 5. User specific code, enable interrupts:
// Enable ADCINT1 in PIE
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE
IER |= M_INT1; // Enable CPU Interrupt 1
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
LoopCount = 0;
// ConversionCount = 0;
// Configure ADC
EALLOW;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; //ADCINT1 trips after AdcResults latch
AdcRegs.INTSEL1N2.bit.INT1E = 1; //Enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 1; //enable ADCINT1 Continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1 ; //setup EOC1 to trigger ADCINT1 to fire
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; //set SOC0 channel select to ADCINA0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 1; //set SOC1 channel select to ADCINA1
// AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
// AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5; //set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; //set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; //set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCINTSOCSEL1.bit.SOC0 = 1; // ADCInterrupt 1 causes SOC0
AdcRegs.ADCINTSOCSEL1.bit.SOC1 = 1;
EDIS;
AdcRegs.ADCSOCFRC1.bit.SOC1 = 1; // kick start ADC by causing a SOC1 event
// Wait for ADC interrupt
for(;;)
{
LoopCount++;
AdcResults[0] = AdcResult.ADCRESULT0;
AdcResults[1] = AdcResult.ADCRESULT1;
AdcResults[2] = AdcResult.ADCRESULT2;
AdcResults[3] = 0; // ADC-A6 NOT AVAILABLE on controlSTICK
AdcResults[4] = AdcResult.ADCRESULT4;
AdcResults[5] = 0; // ADC-A5 DOES NOT EXIST
AdcResults[6] = 0; // ADC-A6 NOT AVAILABLE on controlSTICK
AdcResults[7] = AdcResult.ADCRESULT7;
AdcResults[8] = 0; // ADC-B0 DOES NOT EXIST
AdcResults[9] = AdcResult.ADCRESULT9;
AdcResults[10] = AdcResult.ADCRESULT10;
AdcResults[11] = AdcResult.ADCRESULT11;
AdcResults[12] = AdcResult.ADCRESULT12;
AdcResults[13] = 0; // ADC-B5 DOES NOT EXIST
AdcResults[14] = AdcResult.ADCRESULT14;
AdcResults[15] = AdcResult.ADCRESULT15;
}
}