ΣSigmaStudio Ask AI Русский Log in

Strange Float to HEX number conversion by SigmaStudio

SigmaDSP & SigmaStudio Nando.One Jul 26, 2012 00:00 2 replies Original on forum ↗
Subscribe
Nando.One Question
Jul 26, 2012 00:00

Hi There, how are you?

I'm using SigmaStudio 3.6 along with a ADAU1701 evaluation board. My objective is to update filter coefficients in real time with a PIC microcontroller, so I have to calculate the coefficients (this part is fine) and send data in 4-Byte format. However, I can't figure out what kind of FLOAT to HEX conversion sigma studio makes. For example:

Safeload Write

Time: 0:36:16 - 694ms

IC: IC 1

Cell Name: Gen Filter1_2

Param Name: EQ1940Single20B1

Param Address: 0x0000

Param Value: 0.988578677177429

Bytes: 4

Param Data:

0x00, 0x7E, 0x89, 0xBF

However, if I convert "0.988578677177429" to float on my program, I get a very different result:

0x3F, 0x7D, 0x13, 0x7E

Which is coincident with the result given by this calculator on the internet:

http://gregstoll.dyndns.org/~gregstoll/floattohex/

0x3f7d137e

So I assume that my result is correct.

I suppose there's something different about the conversion realized by SigmaStudio, maybe a different standard perhaps?

Please help me out here, I'd really appreciate your input regarding this, so I can continue developing my project.

Thanks a lot!

Best wishes,

Fernando

Audio Signal Processors

SigmaDSP Audio Processors

adau1701

ADIApproved Reply
Jul 26, 2012 00:00

Hi Fernando,

The SigmaDSP is a fixed-point processor. It does not handle floating point numbers. So, doing a float-to-hex will not get you the result you need.

The number formats in the SigmaDSP are 28-bit fixed point, with the decimal point occurring after the 5th bit (5.23 format), and with negative numbers represented in two's complement. This thread should help you to understand our number formatting: https://ez.analog.com/message/13377#13377

I included a small example of how to convert between formats here: https://ez.analog.com/message/14781#14781

I hope that helps.

Brett

Nando.One Reply
Jul 26, 2012 00:00

Hey, thanks for the links, I completely forgot about this characteristic of the fixed point DSPs, maybe because I started off with SHARC processor!

Thanks BrettG!