Sign in

username:

password:



Not a member?

Search c28x



Search tips

Subscribe to c28x



Discussion Groups

Discussion Groups | TMS320C28x | Software SOC by means of ADCINT_ISR in TMS320F2812

Technical discussions about the TI C28x DSPs (including the C2810, C2811, C2812, F2801, F2806, F2808, F2810,, F2811, F2812, R2811 and R2812).

  

Post a new Thread

Software SOC by means of ADCINT_ISR in TMS320F2812 - sanjay_smarty4u - Jun 7 11:15:26 2007



Hello Folk,
I am newbie to DSP Architecture. Actually, I am trying to convert 
analog voltage in digital by means of a Software SOC as well as ADC 
subroutine (ADCINT_ISR). For this I have configured F2812 for 
cascaded sequencial mode. I have selected A0 channel for Analog 
Input. And all further details is shown on code. I don't know from 
where i am getting wrong. 
May be Interrupt Initialization only. Because after triggering the 
SOC by means of software, it is showing Interrupt Flag set for SEQ1. 
But it is not entering into an ISR. And for ur kind information the 
same configured code is doing well by means of polling method. Any 
suggestions regarding to this will be appericiated. :-)

Here is the code i am posting.

Regards,
Sanjaykumar T.

#include "DSP281x_Device.h"     // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"   // DSP281x Examples Include File
#include <stdio.h>

// ADC start parameters
#define ADC_MODCLK	0x3    
#define ADC_CKPS   	0x1   
#define ADC_SHCLK  	0xf   
#define AVG        	1000  // Average sample limit
#define ZOFFSET    	0x00  // Average Zero offset
#define BUF_SIZE   	2048  // Sample buffer size
// Prototype statements for functions found within this file.
interrupt void sw_trigger_isr(void);
// Global variable for this example
Uint16 SampleTable[BUF_SIZE];
Uint16 i,j,LoopCount;
float output;
const float adclo= 0.025641;

main() 
{
   
   InitSysCtrl();

   EALLOW;
   SysCtrlRegs.HISPCP.all = ADC_MODCLK;	
   EDIS;
   DINT;

   InitPieCtrl();

// Disable CPU interrupts and clear all CPU interrupt flags:
   IER = 0x0000;
   IFR = 0x0000;

   InitPieVectTable();

   EALLOW;  
   PieVectTable.ADCINT = &sw_trigger_isr;
   EDIS;   
   InitAdc();  // For this example, init the ADC

// Specific ADC setup for this example:
   AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;
   AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS;     
   AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;       // 1  Cascaded mode
   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;  // channel A0 selected
   AdcRegs.ADCTRL1.bit.CONT_RUN = 0;       // Setup continuous run

    	PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
	IER |= M_INT6;

// Enable global Interrupts and higher priority real-time debug 
events:
  	EINT;   // Enable Global interrupt INTM
	ERTM;   // Enable Global realtime interrupt DBGM
// Clear SampleTable
   for (i=0; i<BUF_SIZE; i++)
   {
     SampleTable[i] = 0;
   }

   // Start SEQ1
    AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;
    AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1 = 0;
    AdcRegs.ADCMAXCONV.all = 0x0000;

// Take ADC data and log the in SampleTable array  
   while(1)
   {  
     for (i=0; i<AVG; i++)
     {
        AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1;
        LoopCount++;         
     }
   }
}

interrupt void sw_trigger_isr(void)	//ADC ISR (Software SOC)
{

SampleTable[i] =((AdcRegs.ADCRESULT0>>4) );
output = ((3 * (float)SampleTable[i])/4095) - adclo;

AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
		
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;//Acknowledge interrupt to PIE

}

You can post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/c28x/1.php

_____________________________________

 


(You need to be a member of c28x -- send a blank email to c28x-subscribe@yahoogroups.com )