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

how to change tone frequency from MCU

SigmaDSP & SigmaStudio danderson Aug 18, 2012 00:00 2 replies Original on forum ↗
Subscribe
danderson Question
Aug 18, 2012 00:00

Hi,

I have no problems communication with the DSP via I2C and SPI, I am just seaching for a formula to enable me to calculate the 4 Hex bytes I need to send to the DSP (ADAU1442) to change the frequency of a tone.

For example,I can send

0x00 0x01 0x2c 0x60 (obviously after sending the correct address etc) to get 440hz

but I am unsure how the software(SigmaStudio) is calculating this value given as 0.00916671752929688 from my 440hz frequency

Thanks

Danny

KJBob Reply
Aug 19, 2012 00:00

Danny,

The decimal value is equal to your desired frequency divided by the system sample rate. This is the same as the "voltage" that you would connect to a VCO input pin. For the case you cited above,

440 / 48000 = 0.0091667

ADIApproved Reply
Aug 20, 2012 00:00

If you're curious about the math behind the conversion, take a look at my explanation of number formats ( https://ez.analog.com/message/13377#13377 ) and a little example of decimal-to-hex conversion I wrote here ( https://ez.analog.com/message/14934#14934 ).