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.
Hi,
I am trying to utilize both ADC1 and ADC2 in the F28M36 Core. The setup is based on the Concerto Control Card and I am running into an issue that I couldn't solve.
The issue is very simple, configure all available channels for ADC1 and ADC2 and sample them using a trigger such as PWM1 compare event. When ADC1 is configured for this every thing works fine but if the same code is used to utilize the ADC2 module, no interrupts are generated. Please see the code below and provide insight into why the different behavior and why ADC2 is not able to generate EOC interrupts.
The following piece of code works fine and triggers the conversion interrupts as expected.
void ConfigAdc(void)
{
InitAdc1();
InitAdc2();
Adc1OffsetSelfCal();
Adc2OffsetSelfCal();
LoopCount = 0;
ConversionCount = 0;
g_c28EventCounter.cAdc1 = 0;
g_c28EventCounter.cAdc2 = 0;
// Configure ADC
EALLOW;
Adc1Regs.ADCSAMPLEMODE.all = 0x3F;
// Enable simultaneous sampling.
Adc1Regs.ADCCTL2.bit.ADCNONOVERLAP = 1;
// Enable non-overlap mode i.e. conversion and future sampling events dont overlap
Adc1Regs.ADCCTL1.bit.INTPULSEPOS = 1;
// ADCINT1 trips after AdcResults latch
Adc1Regs.INTSEL1N2.bit.INT1E = 1;
// Enabled ADCINT1
Adc1Regs.INTSEL1N2.bit.INT1CONT = 0;
// Disable ADCINT1 Continuous mode
Adc1Regs.INTSEL1N2.bit.INT1SEL = 0;
// setup EOC0 to trigger ADCINT1 to fire
AnalogSysctrlRegs.TRIG1SEL.all = 5;
// Assigning EPWM1SOCA to ADC TRIGGER 1 of the ADC module
Adc1Regs.ADCSOC0CTL.bit.CHSEL = 0;
// set SOC0 channel select to ADC2A0/ADC2B0
Adc1Regs.ADCSOC0CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC0CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc1Regs.ADCSOC1CTL.bit.CHSEL = 2;
// set SOC1 channel select to ADC2A2/ADC2B2
Adc1Regs.ADCSOC1CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC1CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc1Regs.ADCSOC2CTL.bit.CHSEL = 3;
// set SOC0 channel select to ADC2A3/ADC2B3
Adc1Regs.ADCSOC2CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC2CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc1Regs.ADCSOC3CTL.bit.CHSEL = 4;
// set SOC1 channel select to ADC2A4/ADC2B4
Adc1Regs.ADCSOC3CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC3CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc1Regs.ADCSOC4CTL.bit.CHSEL = 6;
// set SOC0 channel select to ADC2A7/ADC2B7
Adc1Regs.ADCSOC4CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC4CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc1Regs.ADCSOC5CTL.bit.CHSEL = 7;
// set SOC1 channel select to ADC2A7/ADC2B7
Adc1Regs.ADCSOC5CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc1Regs.ADCSOC5CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
}
Where as the code shown below utilizes ADC2 module but everything else remains the same and it does not work.
void ConfigAdc(void)
{
InitAdc1();
InitAdc2();
Adc1OffsetSelfCal();
Adc2OffsetSelfCal();
LoopCount = 0;
ConversionCount = 0;
g_c28EventCounter.cAdc1 = 0;
g_c28EventCounter.cAdc2 = 0;
// Configure ADC
EALLOW;
Adc2Regs.ADCSAMPLEMODE.all = 0x3F;
// Enable simultaneous sampling.
Adc2Regs.ADCCTL2.bit.ADCNONOVERLAP = 1;
// Enable non-overlap mode i.e. conversion and future sampling events dont overlap
Adc2Regs.ADCCTL1.bit.INTPULSEPOS = 1;
// ADCINT1 trips after AdcResults latch
Adc2Regs.INTSEL1N2.bit.INT1E = 1;
// Enabled ADCINT1
Adc2Regs.INTSEL1N2.bit.INT1CONT = 0;
// Disable ADCINT1 Continuous mode
Adc2Regs.INTSEL1N2.bit.INT1SEL = 0;
// setup EOC0 to trigger ADCINT1 to fire
AnalogSysctrlRegs.TRIG1SEL.all = 5;
// Assigning EPWM1SOCA to ADC TRIGGER 1 of the ADC module
Adc2Regs.ADCSOC0CTL.bit.CHSEL = 0;
// set SOC0 channel select to ADC2A0/ADC2B0
Adc2Regs.ADCSOC0CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC0CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc2Regs.ADCSOC1CTL.bit.CHSEL = 2;
// set SOC1 channel select to ADC2A2/ADC2B2
Adc2Regs.ADCSOC1CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC1CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc2Regs.ADCSOC2CTL.bit.CHSEL = 3;
// set SOC0 channel select to ADC2A3/ADC2B3
Adc2Regs.ADCSOC2CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC2CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc2Regs.ADCSOC3CTL.bit.CHSEL = 4;
// set SOC1 channel select to ADC2A4/ADC2B4
Adc2Regs.ADCSOC3CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC3CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc2Regs.ADCSOC4CTL.bit.CHSEL = 6;
// set SOC0 channel select to ADC2A7/ADC2B7
Adc2Regs.ADCSOC4CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC4CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
Adc2Regs.ADCSOC5CTL.bit.CHSEL = 7;
// set SOC1 channel select to ADC2A7/ADC2B7
Adc2Regs.ADCSOC5CTL.bit.TRIGSEL = 5;
// Set Trigger 1 for Start of Conversion.
Adc2Regs.ADCSOC5CTL.bit.ACQPS = 6;
// set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
}
Muhammad Sami1 said:When ADC1 is configured for this every thing works fine but if the same code is used to utilize the ADC2 module, no interrupts are generated.
Have you modified PieVectTable, PieCtrlRegs, and IER to set ADC2 interrupt?
Best regards,
Maria
I have both ADCINT1 and ADCINT2 configured as shown in the code below. A counter is incremented to see if the interrupt is firing. I have also noticed that the interrupt count is 1 so interrupts only trigger once and after that no more interrupt even though the compare event is triggering continuously.
// Code for firing ADC SOC
//Set event triggers (SOCA) for ADC SOC1
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTRU_CMPA; // Select SOC from CMPA on upcount
EPwm1Regs.ETPS.bit.SOCAPRD = 3; // Generate pulse on every 3rd event
// Code for initialing ADC Interrupts.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.ADCINT1 = &adc1_isr;
PieVectTable.ADCINT2 = &adc2_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
IER |= M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE
PieCtrlRegs.PIEIER1.bit.INTx2 = 1; // Enable INT 1.2 in the PIE
__interrupt void adc1_isr(void)
{
g_c28EventCounter.cAdc1++;
Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize for next SOC
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
}
__interrupt void adc2_isr(void)
{
g_c28EventCounter.cAdc2++;
Adc2Regs.ADCINTFLGCLR.bit.ADCINT2 = 1; //Clear ADCINT2 flag reinitialize for next SOC
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
}
Muhammad,
It looks like you are using ADCINT1 for both ADCs so nothing is generating ADCINT2. Instead, they are both generating ADCINT1 because the ADCINTx signals are shared between ADCs.
Adc1Regs.INTSEL1N2.bit.INT1E = 1;
// Enabled ADCINT1
Adc1Regs.INTSEL1N2.bit.INT1CONT = 0;
// Disable ADCINT1 Continuous mode
Adc1Regs.INTSEL1N2.bit.INT1SEL = 0;
// setup EOC0 to trigger ADCINT1 to fire
....
Adc2Regs.INTSEL1N2.bit.INT1E = 1;
// Enabled ADCINT1
Adc2Regs.INTSEL1N2.bit.INT1CONT = 0;
// Disable ADCINT1 Continuous mode
Adc2Regs.INTSEL1N2.bit.INT1SEL = 0;
// setup EOC0 to trigger ADCINT1 to fire
-Tommy
Hi Tommy,
I have already tried ADCINT2 using the following changes but no luck either. In this situation you get back to back interrupts as if the interrupt is not even getting acknowledged in the ISR even though both the ISR handlers clear the interrupt pending flags for their respective interrupt.
Adc2Regs.INTSEL1N2.bit.INT2E = 1; // Enabled ADCINT2
Adc2Regs.INTSEL1N2.bit.INT2CONT = 0; // Disable ADCINT2 Continuous mode
Adc2Regs.INTSEL1N2.bit.INT2SEL = 0; // Setup EOC0 to trigger ADCINT2 to fire
I also observed that the ISR is always triggered by both ADCs at least once even though it is not configured to do so, which seems strange.
In addition, with interrupt 2 enabled for ADC2, the flag still indicates interrupt 1 pending for ADC2 which does not make sense as the ADC1 is not even configured for generating any interrupts.
I have tried all these combinations, please let me know if you have any questions,
I would also like to request a piece of code or sample that could scan all the 24 ADC channels for both ADC1 and ADC2 modules in simultaneous mode and provides event triggers for both ADC modules to capture the sampled signals. This will really help.
Muhammad,
I think you are on the right track, but there might be interrupt triggers carried over between test runs. Did you try to fully power off/on the board to make sure that everything has been reset? I usually do this when making significant changes to the interrupt settings. A device reset is also recommended between runs.
It also sounds like there might be too many variables in play here. I would recommend getting ADC1 to work by itself using ADCINT1. Then, get ADC2 to work by itself with ADCINT2. When those are working standalone, it should be much easier to integrate the two together.
-Tommy
Hi Tommy,
As I mentioend at the begining of the post that If I just use ADC1 it works fine, Its the ADC2 that has the problem. I have been working on this for almost a week and tried various combinations, I am using Flash for code runs and cycled power completely to ensure that the chip goes through full power on reset. In addition I am using TI provided code shown below for initializing, configuring and calibrating the ADCs and I am at a loss here. Besides I am seeing the chip behavior which is rather erratic and I haven't found any explanation for the behavior described in the post anywhere in the Concerto user manaul.
InitAdc1();
InitAdc2();
Adc1OffsetSelfCal();
Adc2OffsetSelfCal();
I would really appreciate if you could provide a code snippet that works with ADC2. Modifying a functional ADC1 code for ADC2 hasn't helped me so far and I have gone through the user manual and available samples many times to figure out the problem area but no luck, so here I am and I have to post it here to get the expert opinion and hoping for a resolution.
Hi Tommy, Really hoping to get a resolution for this issue.
And I also should have referred to you as a Mastermind based on your ranking and not an expert. Just noticed that. My mistake and my apologies.
Muhammad,
Here is a modified version of the ControlSUITE example that works on my setup.
-Tommy
//########################################################################### // FILE: adc_soc_c28.c // TITLE: ADC1 Start-Of-Conversion (SOC) Example Program. // //! \addtogroup control_example_list //! <h1> ADC1 Start of Conversion (adc_soc)</h1> //! //! This ADC example uses ePWM1 to generate a periodic //! ADC SOC - ADCINT1. Two channels are converted, //! ADC1A0 and ADC1A2. //! //! \b Watch \b Variables \n //! - Voltage1[10] - Last 10 ADCRESULT0 values //! - Voltage2[10] - Last 10 ADCRESULT1 values //! - ConversionCount - Current result number 0-9 //! - LoopCount - Idle loop counter // //########################################################################### // $TI Release: F28M36x Support Library v202 $ // $Release Date: Tue Apr 8 12:36:34 CDT 2014 $ //########################################################################### #include "DSP28x_Project.h" // Device Headerfile and Examples Include File #include <string.h> #define DUTY_CYCLE_A 500 #define DUTY_CYCLE_B 500 #define PERIOD 1000 // Prototype statements for functions found within this file. __interrupt void adc1_isr(void); __interrupt void adc2_isr(void); // Global variables used in this example: Uint16 LoopCount; Uint16 ConversionCount; Uint16 ConversionCount2; Uint16 Voltage1[10]; Uint16 Voltage2[10]; Uint16 Voltage3[10]; Uint16 Voltage4[10]; main() { *(unsigned int*)0x4E58 = 7; (**InitAnalogSystemClock)(ACLKDIV4); // Step 1. Initialize System Control for Control and Analog Subsytems // Enable Peripheral Clocks // This example function is found in the F28M36x_SysCtrl.c file. InitSysCtrl(); // If project is linked into flash, copy critical code sections to RAM. #ifdef _FLASH memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // Step 2. Initialize GPIO: // This example function is found in the F28M36x_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Skipped for this example EALLOW; GpioG1CtrlRegs.GPADIR.bit.GPIO0 = 1; //Set as output GpioG1CtrlRegs.GPADIR.bit.GPIO8 = 1; //Set as output GpioG1CtrlRegs.GPAMUX1.bit.GPIO0 = 1; //Set mux to EPWM1A GpioG1CtrlRegs.GPAMUX1.bit.GPIO8 = 3; //Set mux to ADCSOCAn EDIS; // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F28M36x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F28M36x_DefaultIsr.c. // This function is found in F28M36x_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected register PieVectTable.ADCINT1 = &adc1_isr; PieVectTable.ADCINT2 = &adc2_isr; EDIS; // This is needed to disable write to EALLOW protected registers // Step 4. Initialize all the Device Peripherals: // This function is found in F28M36x_InitPeripherals.c // InitPeripherals(); // Not required for this example InitAdc1(); // For this example, init the ADC InitAdc2(); // For this example, init the ADC Adc1OffsetSelfCal(); Adc2OffsetSelfCal(); // Step 5. User specific code, enable interrupts: // Enable ADCINT1 in PIE PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE PieCtrlRegs.PIEIER1.bit.INTx2 = 1; // Enable INT 1.2 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; Adc1Regs.ADCCTL2.bit.ADCNONOVERLAP = 1; // Enable non-overlap mode i.e. // conversion and future // sampling // events dont overlap Adc1Regs.ADCCTL1.bit.INTPULSEPOS = 1; // ADCINT1 trips after // AdcResults latch Adc1Regs.INTSEL1N2.bit.INT1E = 1; // Enabled ADCINT1 Adc1Regs.INTSEL1N2.bit.INT1CONT = 0; // Disable ADCINT1 Continuous // mode Adc1Regs.INTSEL1N2.bit.INT1SEL = 0; // setup EOC0 to trigger ADCINT1 // to fire Adc1Regs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to // ADC1A0 Adc1Regs.ADCSOC1CTL.bit.CHSEL = 2; // set SOC1 channel select to // ADC1A2 AnalogSysctrlRegs.TRIG1SEL.all = 5; // Assigning EPWM1SOCA to // ADC TRIGGER 1 of the ADC module Adc1Regs.ADCSOC0CTL.bit.TRIGSEL = 5; // Set SOC0 start trigger to // ADC Trigger 1(EPWM1 SOCA) of the // adc Adc1Regs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger to // ADC Trigger 1(EPWM1 SOCA) of the // adc Adc1Regs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC // Clock Cycles, (6 ACQPS plus // 1) Adc1Regs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC // Clock Cycles, (6 ACQPS plus // 1) Adc2Regs.ADCCTL2.bit.ADCNONOVERLAP = 1; // Enable non-overlap mode i.e. // conversion and future // sampling // events dont overlap Adc2Regs.ADCCTL1.bit.INTPULSEPOS = 1; // ADCINT1 trips after // AdcResults latch Adc2Regs.INTSEL1N2.bit.INT2E = 1; // Enabled ADCINT1 Adc2Regs.INTSEL1N2.bit.INT2CONT = 0; // Disable ADCINT1 Continuous // mode Adc2Regs.INTSEL1N2.bit.INT2SEL = 0; // setup EOC0 to trigger ADCINT1 // to fire Adc2Regs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to // ADC1A0 Adc2Regs.ADCSOC1CTL.bit.CHSEL = 2; // set SOC1 channel select to // ADC1A2 AnalogSysctrlRegs.TRIG1SEL.all = 5; // Assigning EPWM1SOCA to // ADC TRIGGER 1 of the ADC module Adc2Regs.ADCSOC0CTL.bit.TRIGSEL = 5; // Set SOC0 start trigger to // ADC Trigger 1(EPWM1 SOCA) of the // adc Adc1Regs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger to // ADC Trigger 1(EPWM1 SOCA) of the // adc Adc1Regs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC // Clock Cycles, (6 ACQPS plus // 1) Adc1Regs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC // Clock Cycles, (6 ACQPS plus // 1) EDIS; //// Assumes ePWM1 clock is already enabled in InitSysCtrl(); //Set event triggers (SOCA) for ADC SOC1 EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTRU_CMPA; // Select SOC from CMPA on // upcount EPwm1Regs.ETPS.bit.SOCAPRD = 3; // Generate pulse on every 3rd // event // Time-base registers EPwm1Regs.TBPRD = PERIOD; // Set timer period, PWM // frequency = 1 / period EPwm1Regs.TBPHS.all = 0; // Time-Base Phase Register EPwm1Regs.TBCTR = 0; // Time-Base Counter Register EPwm1Regs.TBCTL.bit.PRDLD = TB_IMMEDIATE; // Set Immediate load EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; // Count-up mode: used for // asymmetric PWM EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE; EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; // Setup shadow register load on ZERO EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero // Set Compare values EPwm1Regs.CMPA.half.CMPA = DUTY_CYCLE_A; // Set duty 50% initially EPwm1Regs.CMPB = DUTY_CYCLE_B; // Set duty 50% initially // Set actions EPwm1Regs.AQCTLA.bit.ZRO = AQ_SET; // Set PWM2A on Zero EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR; // Clear PWM2A on event A, up // count EPwm1Regs.AQCTLB.bit.ZRO = AQ_CLEAR; // Set PWM2B on Zero EPwm1Regs.AQCTLB.bit.CBU = AQ_SET; // Clear PWM2B on event B, up // count // Wait for ADC interrupt for(;;) { LoopCount++; } } __interrupt void adc1_isr(void) { Voltage1[ConversionCount] = Adc1Result.ADCRESULT0; Voltage2[ConversionCount] = Adc1Result.ADCRESULT1; // If 20 conversions have been logged, start over if(ConversionCount == 9) { ConversionCount = 0; } else ConversionCount++; Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize // for next SOC PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE return; } __interrupt void adc2_isr(void) { Voltage3[ConversionCount] = Adc2Result.ADCRESULT0; Voltage4[ConversionCount] = Adc2Result.ADCRESULT1; // If 20 conversions have been logged, start over if(ConversionCount2 == 9) { ConversionCount2 = 0; } else ConversionCount2++; Adc2Regs.ADCINTFLGCLR.bit.ADCINT2 = 1; //Clear ADCINT1 flag reinitialize // for next SOC PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE return; }