Hi,
To all,
I m working on ADC. As per example i have taken ADC sample in continuous polling like this way
EALLOW;
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
ADC_cal();
EDIS;
AdcRegs.ADCTRL3.all = 0x00E0; // Power up bandgap/reference/ADC circuits
delay(50000); // Delay before converting ADC channels
delay(50000);
AdcRegs.ADCTRL1.bit.ACQ_PS = 14;
AdcRegs.ADCTRL3.bit.ADCCLKPS = 15;
AdcRegs.ADCTRL1.bit.CPS = 1;
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 Cascaded mode
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;
AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Setup continuous run
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 0x1;
AdcRegs.ADCTRL2.all = 0x2000;
for(;;)
{
while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {} // Wait for interrupt
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
SampleTable[index] =((AdcRegs.ADCRESULT0>>4) );
}
By this method i am getting sample but when I want to go for interrupt base sampling than there is no interrupt generation it means it is not going in to ISR even for a single time below is the intterupt based code.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &cpu_timer0_isr;
PieVectTable..ADCINT= &ADC_isr;
EDIS;
EALLOW;
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
ADC_cal();
EDIS;
AdcRegs.ADCTRL3.all = 0x00E0; // Power up bandgap/reference/ADC circuits
delay(50000); // Delay before converting ADC channels
delay(50000);
AdcRegs.ADCTRL1.bit.ACQ_PS = 14;
AdcRegs.ADCTRL3.bit.ADCCLKPS = 15;
AdcRegs.ADCTRL1.bit.CPS = 1;
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 Cascaded mode
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;
AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Setup continuous run
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 0x1;
// Enable TINT0 in the PIE: Group 1 interrupt 7
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
IER |= M_INT1;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
AdcRegs.ADCTRL2.all = 0x2000;
for(;;){}
interrupt void ADC_isr(void)
{
SampleTable[index] =((AdcRegs.ADCRESULT0>>4) );
index++;
if(index==499)
{
index = 0;
}
else AdcRegs.ADCRESULT0;
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
referance for this also i have taken from the TI example but still its not Working
Has anyone faced this kind of problem in ADC ISR than just help me.
Now i am planning to start DMA for ADC data.
Thanks in Advance..
Regards,
Chintan