Showing results for 
Search instead for 
Did you mean: 

fpga sinusoidal signal

Go to solution

hello, i wanted to know about can i adjust the freq of the signal via control or will it be bad decision? what is the problem here? or will it be better to set up timer in the loop and subtract it from outside the timer? can u pls help. i know it is super easy for u guys, but i ve encountered this device for the 1st time. also that freq is weird so it s not in herz yes? i must take a note ticks but period is it in radians? how to set up freq if i just want 30hz sinusoidal signal. i am confused heelp. thank U.


i connected it to osciloscope and nothing just very fast signal with the same amplitude. i didnt understand how does freq works in fpga sin generator. 


0 Kudos
Message 1 of 8

Your Loop Timer is placed outside the while loop. It is useless.

The FPGA timing is usually defined in ticks because different clock sources might be used. Although 40MHz is the default clock for most NI FPGA hardware, you can always use a different derived clock. Hz to ticks conversion is usually done on the host side.


I would recommend you refer to the shipping examples at Example Finder >> Hardware Input and Output >> R Series or compactRIO >> Signal Generation and Processing >> Analog >> Generation >> Sine Wave

Control Lead | Intelline Inc
0 Kudos
Message 2 of 8




yes i know i realised it, but here it still question like that can i change freq. of the signal 

0 Kudos
Message 3 of 8

It seems like you are using the LabVIEW for the first time too. Yes, you can change frequency and amplitude of your sine waveform as needed. See below:

FPGA Loop.png

You can skip the peak value part.

Frequency and Scale Factor Calculation.png
Forgot where I got the 20 from. Edit: But it works just fine.


Static settings (if you need it):



0 Kudos
Message 4 of 8

hi, yes, i didnt use labview before that much.


i have questions about loop time, why did u use feedback ? and if i wanna set loop rate to some value should it be in tick and how much tick?


i have noticed the correlation between loop rate and sample rate of the signal, can u explain that part? u didnt in yr reply.


my main purpose of the task is to generate the specific sine wave with freq 35 Hz, and with amplitude 30mV,  and output it.  In the settings why i should do full scale? 


and tbh i created just like yrs block diagram but it didnt show proper sine wave it was like digitised sine wave.

once again pls if u wanna help me my task is to create sine wave with particularly freq and amplitude and send it to analog output of myrio 1900. are there any other options  to do that without fpga ? 


thank u 

0 Kudos
Message 5 of 8

Can you attach your VI please? Save it for 2019. (Save for previous version)


To your questions:

1) Feedback for loop time is used to calculate the loop rate by subtracting last loop value to new.

2) If you want to loop rate to some value then you will calculate 25ns x ticks = 25 times the ticks. 25ns is resolution of your FPGA's base clock.

3) Simply put, you would want your loop to run faster than the frequency you are trying to output. If it is slower then you will get a weird output.

4) Scale factor will bring down our value to the desired value. You mentioned "i connected it to osciloscope and nothing just very fast signal with the same amplitude" gave an impression that you want variable amplitude sine wave. But if your amplitude is fixed, simply set that in the  Sine Wave Generator VI.


5) I only know how to do if using FPGA. But yes, sure, you should be able to use DAQmx VIs to do this from RT side. But there is not magic button for that there either, you will have some learning curve there too.


If you can show what progress you have made, I or someone else might be able to suggest next step. Right now its hard to know what you did wrong.


0 Kudos
Message 6 of 8

thank u, here the name of it is 

0 Kudos
Message 7 of 8
Accepted by topic author

It seems like you have shared an example project from NI. Not what you have done.

Anyways, try to run the attached VI under FPGA. First see if you are getting a sine wave on oscilloscope or not. You should be getting 0-5V range sinewave on MXP connector and a different range on MSP. It will be of 35Hz.


If you get the sine wave, you can simply adjust the amplitude.


Edit: 30mV is quite low. You might end up using MXP connection for that as steps are smaller on MXP connector.

0 Kudos
Message 8 of 8