# Value Conversion

Question asked by Simmartin on Apr 23, 2010
Latest reply on Apr 24, 2010 by Simmartin

Hi! I have some problems with the conversion value from what I read in the scheme, and the Hex data that it sould be wrote in the AD1701...

For example, with a Tone module, if I put a

- 1 Hz oscillation, I receive the 0x015E data value (I read it in the output window)

- 2 Hz oscillation, I receive the 0x02BB data value

- 3 Hz oscillation, I receive the 0x0419 data value....

So, it seems that if I pass from 1Hz to 2Hz, I have to add 0x015D, but if i pass from 2Hz and 3 Hz I have to add 0x15E (which is the 1 Hz value...)

With some calculations, I assume that it is an approximation problem. In fact, if we want 1 Hz, we have to

349.5 * 1Hz = 349.5 ==> so we assume the decimal value 350 that is in fact 15E...if we want 2 Hz, we do

349.5 * 2Hz = 699 ==> 2BB, that is the value for 2 Hz...

In this way, I can get my desired Frequency, considering the approximation, but I can't calculate any value under 1. With the ToneGenerator, I have a minimum resolution of 0.01 Hz...so

- 0.01Hz = 0x3

- 0.02Hz = 0x7

- 0.03Hz = 0xA...

So here we have to add 3 or 4, so 3.5... but for now I don't need a so little resolution...

A similar problem is that in the "State Var Filter" (the one with numeric Q) the

-1Hz = 0x44A (the minimum resolution)

-2Hz = 0x894

-3Hz = 0xCDE

It seems that it is more linear, because I have to add 0x44A, from 1 to 2, and for 2 to 3...so HEX=(frequency)*0x44A = frequency* 1098...but

if I calculate it for 10 Hz, I expect for 10980=2AE4...but I see 2AE5(10981)!!

I need the RIGHT formulas to get the RIGHT values from ANY blocks in SigmaDSPs....

For now, it is very difficult to implement in a uC the right functions to know what number we have to put in the DSPs...

OR am I in WRONG with something!?!? if so, I apologize...but I really need your help!! Thank You All!!