DSPRelated.com
Forums

doubts in 2181....

Started by swaminathan padmanabhan May 4, 2005
hai guys
i am swaminathan from chennai, india.
i have planned to do a project of power measurement in 2181, which is nothing but getting the samples of VOLTAGE and CURRENT(simultaneously) through the codec AD1847 and finding the product between them.
as the processor is 16bit i am not able to get the product of the fractional nos exactly.
for example, when i tried with the sample values for the registers mx0 and mx1 as 0.5255 and 0.0125 i get a value greater than 16 bit so the values are getting written in two separate registers.....
how to work on this... how to increase the accuracy......
i also don't know how to use the 1847 codec for my work , where i need the samples of two inputs simultaneously......
can anybody explain how to proceed with this.


Hi Swaminathan,
If you multiply the MX0 and MY0 value then result is store in the 40 bit
register i.e MR0, MR1, MR2 out of this two are 16 bit and one is 8 bit.so
as you implementating the next algorithm consider the 40 value as your data,
and at the end, when you want to out the data through DAC , then convert
this data to 8 bit or 12 bit depend on you DAC .
If you want to convert the 40 bit data to 12 bit data then consider the 12
MSB this will be done by using Shifter Register i.e. SR0 and SR1.
Is your project is related to Power Factor Correction..?

Regards
Chandrakant
Pune.

---- Original Message -----
From: swaminathan padmanabhan <swame_dsp@swam...>
To: <adsp@adsp...>
Sent: Wednesday, May 04, 2005 11:41 PM
Subject: [adsp] doubts in 2181.... > hai guys
> i am swaminathan from chennai, india.
> i have planned to do a project of power measurement in 2181, which is
nothing but getting the samples of VOLTAGE and CURRENT(simultaneously)
through the codec AD1847 and finding the product between them.
> as the processor is 16bit i am not able to get the product of the
fractional nos exactly.
> for example, when i tried with the sample values for the registers mx0
and mx1 as 0.5255 and 0.0125 i get a value greater than 16 bit so the values
are getting written in two separate registers.....
> how to work on this... how to increase the accuracy......
> i also don't know how to use the 1847 codec for my work , where i need the
samples of two inputs simultaneously......
> can anybody explain how to proceed with this.


Two issues:

1) Please read up on fractional arithmetic on the web. You are
multiplying two 1.15 numbers and ignoring the upper 8-bits of the
accumulator, you are getting a 1.31 result. You would think it was a
2.30, but the DSP does a one-bit left product shift automatically
unless you are programming in C. Then the C-compiler disables the
one-bit left shift so that it defaults to integer multiply mode. In
C, you can temporariliy reenable the one-bit left shift by asm("dis
m_mode;"); and when you are done, put the part back in integer mode by
asm("ena m_mode;");

Back to fractional arithmetic, if you multiply 0.5*0.5 =
0x4000*0x4000, you get 0x20000000 in MR1:MR0. By reading the MR1, the
upper 16-bits (1.15 of 1.31), you read 0x2000 or 0.25 which is correct.

2) You are using a sigma-delta ADC inside the AD1847 codec. Not all
sigma-delta converters are accurate for DC measurements. I do not
remember the DC specs of this part, but you need to read the datasheet
and make sure it will not filter out DC or be less accurate with DC input.

Good luck,

Dan Ash

--- In adsp@adsp..., swaminathan padmanabhan <swame_dsp@y...>
wrote:
> hai guys
> i am swaminathan from chennai, india.
> i have planned to do a project of power measurement in 2181, which
is nothing but getting the samples of VOLTAGE and
CURRENT(simultaneously) through the codec AD1847 and finding the
product between them.
> as the processor is 16bit i am not able to get the product of the
fractional nos exactly.
> for example, when i tried with the sample values for the registers
mx0 and mx1 as 0.5255 and 0.0125 i get a value greater than 16 bit so
the values are getting written in two separate registers.....
> how to work on this... how to increase the accuracy......
> i also don't know how to use the 1847 codec for my work , where i
need the samples of two inputs simultaneously......
> can anybody explain how to proceed with this.