Sign in

username:

password:



Not a member?

Search c28x



Search tips

Subscribe to c28x



Discussion Groups

Discussion Groups | TMS320C28x | sine table

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

sine table - kalpana rayala - Mar 9 9:46:46 2007



hello
i am using TMS320F2812. I would like to know how to access the Sine Table in
the boot ROM .The IQMATH seems to be useful only for C and C++ programming
only. How to access the sine table ?
kalpana



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

Re: sine table - mmaz...@terahertztechnologies.com - Mar 27 8:52:40 2007

Hi Kalpana,

I was wondering if you received any pointers on accessing the sine table?  I think I also would
like to use it without using IQMath? I'm experienced at assembly but not much C/C++.
Mike

hello
>i am using TMS320F2812. I would like to know how to access the Sine Table in
>the boot ROM .The IQMATH seems to be useful only for C and C++ programming
>only. How to access the sine table ?
>kalpana
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 )

Re: sine table - vsra...@gmail.com - Mar 28 8:00:38 2007

If you need sine table in ASM, u need to create ur own.
You will have better luck if you know what angles you are going to use.

If you know that you will have 10,15,20,25.... and so on.

Make a table in your code and put all Sine values of corresponding angles and use it whenever
you want.

I used this approach because I knew I will have only 30,60,90... angles.

I will keep looking this thread to see better solution
Cheers

Viks
>hello
>i am using TMS320F2812. I would like to know how to access the Sine Table in
>the boot ROM .The IQMATH seems to be useful only for C and C++ programming
>only. How to access the sine table ?
>kalpana
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 )

Re: Re: sine table - Beat Arnet - Mar 28 8:01:36 2007

I am not too familiar with the 2812, but I suspect that the sine table 
is stored in the boot ROM. If this is the case, you need to create a 
routine that executes from RAM which enables the boot ROM, does the 
lookup and then makes the FLASH visible again.

Cheers,
Beat

m...@terahertztechnologies.com wrote:
>
> Hi Kalpana,
>
> I was wondering if you received any pointers on accessing the sine 
> table? I think I also would like to use it without using IQMath? I'm 
> experienced at assembly but not much C/C++.
> Mike
>
> hello
> >i am using TMS320F2812. I would like to know how to access the Sine 
> Table in
> >the boot ROM .The IQMATH seems to be useful only for C and C++ 
> programming
> >only. How to access the sine table ?
> >kalpana
> >
> >  


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

Re: sine table - gopalakrishnan vishal anand - Mar 29 8:18:35 2007

// Locate ISR in L0RAM
#pragma CODE_SECTION(Timer1_UnderFlow_ISR, "ramfuncs");
/************** TIMER1 UNDERFLOW INTERRUPT SERVICE ROUTINE **************/
interrupt void Timer1_UnderFlow_ISR(void)
/*********************************************************************/
{
	//Uint16* uiTemp;
	//int16 temp3;
//int32 temp1,temp2,temp3;
//Uint16 Compare_value;

EPwm1Regs.ETCLR.bit.INT = 1;
sin_ampl = 0.79;

// Acknowledge this interrupt to receive more interrupts from group 3
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

if (pSineTable1 < ((ROM_SIN_TBL_BASE_ADDR + ROM_SIN_TBL_LENGTH)))
	{
		Sample_Number++;
		if (Sample_Number >= 512)
			{
				Sample_Number = 0;
				uiRMSFlag=1;
			}
		EPwm1Regs.CMPA.half.CMPA = SineTableModulator(pSineTable1,sin_ampl,EPwm1Regs.TBPRD);
		pSineTable1++;
		
		if (Count_Diff_1_2 <= COUNT_DIFF_1_2_MIN_VALUE)
			{
				Count_Diff_1_2 = COUNT_DIFF_1_2_MIN_VALUE;
			}
		else if (Count_Diff_1_2 >= COUNT_DIFF_1_2_MAX_VALUE)
			{
				Count_Diff_1_2 = COUNT_DIFF_1_2_MAX_VALUE;
			}
		if (pSineTable1 >= ROM_SIN_TBL_BASE_ADDR + (ROM_SIN_TBL_LENGTH - Count_Diff_1_2))
			{
				pSineTable2 = pSineTable1 - (ROM_SIN_TBL_LENGTH - Count_Diff_1_2);
			} 
		else
			{
				pSineTable2 = pSineTable1 + Count_Diff_1_2;
			}
		EPwm2Regs.TBPRD = EPwm1Regs.TBPRD;
		EPwm2Regs.CMPA.half.CMPA = SineTableModulator(pSineTable2,sin_ampl,EPwm2Regs.TBPRD);		

		if (Count_Diff_1_3 <= COUNT_DIFF_1_3_MIN_VALUE)
			{
				Count_Diff_1_3 = COUNT_DIFF_1_3_MIN_VALUE;
			}
		else if (Count_Diff_1_3 >= COUNT_DIFF_1_3_MAX_VALUE)
			{
				Count_Diff_1_3 = COUNT_DIFF_1_3_MAX_VALUE;
			}
		if (pSineTable1 >= ROM_SIN_TBL_BASE_ADDR + (ROM_SIN_TBL_LENGTH - Count_Diff_1_3))
			{
				pSineTable3 = pSineTable1 - (ROM_SIN_TBL_LENGTH - Count_Diff_1_3);
			} 
		else
			{
				pSineTable3 = pSineTable1 + (Count_Diff_1_3);
			}
		EPwm3Regs.TBPRD = EPwm1Regs.TBPRD;
		EPwm3Regs.CMPA.half.CMPA = SineTableModulator(pSineTable3,sin_ampl,EPwm3Regs.TBPRD);		
	}
else
	{
		pSineTable1 = ROM_SIN_TBL_BASE_ADDR;
	}
/*
if (Sample_Number == 0)
	{
		PhaseLockLoop();
	}
*/
// The code written below determines the timings of the scheduled events

if (Sample_Number == EventArray[Ecount].Scheduled_Event_Sample)
	{
		Ecount1 = Ecount;
		if (Ecount < (NUM_EVENTS-1))
			{
				Ecount++;
			}
		else
			{
				Ecount = 0;
			}
		EventScheduledFlag = TRUE;	
	}

	if((Sample_Number%8)==7)
	{
		uiBufferNo++;
		BE_SocADC();
		BE_UpdateRMSArray();
		if(uiBufferNo==0x040)
		{
		uiBufferNo=0x00;
		}
		
	}

}

#pragma CODE_SECTION(SineTableModulator, "ramfuncs");

int16 SineTableModulator(int32 *SineTableEntry, float SineAmplitude, Uint16 Period_Value)
{

int32 CurrentSineTableEntry, NormalisedSine;
Uint16 Compare_value;

CurrentSineTableEntry = _IQmpy((*SineTableEntry),_IQ(SineAmplitude));
CurrentSineTableEntry+=(*(POS_PEAK_ADDR_OFFSET));
NormalisedSine = _IQdiv(CurrentSineTableEntry/2,*(POS_PEAK_ADDR_OFFSET));
Compare_value =_IQtoQ15(_IQmpy(NormalisedSine,_Q15toIQ(Period_Value)));

return (Compare_value);

}



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

Re: sine table - Arun Karuppaswamy B - Mar 29 8:19:02 2007

Hi all,
         I posted this same question long time back... but then, I got no reply.  Here is what
I did... this is a bit of round about process. But it helps my purpose wherein I require a sine
table with 200 points. The process is simple: Use the Taylor's series expansion for sine and
write an assembly code to create the sine table in any location you wish. Using the first four
terms of Taylor's series itself would help. Most of the time, the sine table has to be built
before the actual processing starts. So, computation time is not of importance. However, you
will require to give theta in radians. So, there will be a problem of finding the sine values
for large values of theta. In my case I used Q2.14 format. So, I calculated sine(theta) till 90
degrees and the exploited the symmetry to fill up the rest of the table. In case you use Q1.15
format, you limit your calculation till 45 degrees and exploit the symmetry and the fact that
sin (90 - theta) = cos(theta). Hope this
 helps some ppl atleast.

Regards,
   akp.

----- Original Message ----
From: "v...@gmail.com" <v...@gmail.com>
To: c...@yahoogroups.com
Sent: Wednesday, March 28, 2007 5:30:35 PM
Subject: [c28x] Re: sine table
If you need sine table in ASM, u need to create ur own.
You will have better luck if you know what angles you are going to use.

If you know that you will have 10,15,20,25. ... and so on.

Make a table in your code and put all Sine values of corresponding angles and use it whenever
you want.

I used this approach because I knew I will have only 30,60,90... angles.

I will keep looking this thread to see better solution
Cheers

Viks

>hello
>i am using TMS320F2812. I would like to know how to access the Sine Table in
>the boot ROM .The IQMATH seems to be useful only for C and C++ programming
>only. How to access the sine table ?
>kalpana

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 )