DSPRelated.com
Forums

Comute the analogue signal's rms value for 1024 samples

Started by buddhi_d February 18, 2008
Dear all,

I am new to the group,In the part of my project(using TMS320VC33), I
would like to develope and implement analogue Signal using lookup
table in Assembly language or code composser studio.
For the implementing the analogue signal i chose the sine wave .so
that
the C source for sine function using lookup table is as follows,
************************************
signed int Sin(unsigned int phase)
{
const static S16 sin_table[66] {
0,804,1608,2410,3212,4011,4808,5602,
6393,7179,7962,8739,9512,10278,11039,11793,
12539,13279,14010,14732,15446,16151,16846,17530,
18204,18868,19519,20159,20787,21403,22005,22594,
23170,23731,24279,24811,25329,25832,26319,26790,
27245,27683,28105,28510,28898,29268,29621,29956,
30273,30571,30852,31113,31356,31580,31785,31971,
32137,32285,32412,32521,32609,32678,32728,32757,
32767,32757
};
S16 s0;
U16 tmp_phase, tmp_phase_hi;

tmp_phase = phase&0x7fff;

if(tmp_phase&0x4000) tmp_phase = 0x8000 - tmp_phase;

tmp_phase_hi = tmp_phase>>8; // 0...64

s0 = sin_table[tmp_phase_hi];

s0 += ((S16)((((S32)(sin_table[tmp_phase_hi+1] - s0))*
(tmp_phase&0xff))>>8));

if(phase&0x8000) s0 = -s0;

return s0;
}
***************************
which is working fine.
I am trying to compute the root mean squre of the analogue signal.
(for 1024 samples)
Is any body can provide better solution, and solving this problem ?
your help will greatly appreciated.

waiting for your messages and help,

regards,
buddhi

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467