Sinusoidal signal generation with the "sinf" fonction

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I want to generate a sinusoidal signal with its 3 parameters (Amplitude, Frequency, Phase) controlled with 3 potentiometers.  So i have 3 PGA, a TRIADC and a DAC9.

   

Firstly, in the C program, i have forced the 3 parameters to generate a 440Hz sinusoide (Amplitude=0.5 and Phase=0). I use the math function "sinf" to compute samples in real time. Each sample is computed before the data is written by the DAC9 at a frequency of 125kspls / s. I check the 3 parameters every 50 ms which correspond to one periode of the lowest frequency i want to generate (20Hz)

   

I have tried a lot of things (also in the C program the data format is set to offsetbinary althought i will use the 2 bytes signed and magnitude format for the DAC9) and i don't make it work.

   

You'll find in attachment my project. Thank you to have a look and comments.

   

With best regards

0 Likes
1 Reply
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Laborie,

   

 

   

I suggest you try to get the three ADCs working first. Use 3 DACs which will accept the codes got from the ADC. This way you would be able to check by turning the potentiometers, and looking into the DAC outputs. 3 DAC6 UMs should be fine for the three ADCs. 

   

Also, using a timer to time the sinusoidal samples would be better, otherwise the sinusoid would be jittery.

   

125Khz sample rate is too high to be able to compute sine.Have you considered using a look-up table instead?

   

Sampath

0 Likes