04-10-2018 03:18 PM
I'm working on a project that involves creating synchronization waveforms to be used outside of an NI compact Rio. I can guarantee that my cRIO clock times are synchronized (using TSN/802.1AS in the cRIO 9035s). Based on an example I found, I have labview generating a square wave based on switching the signal every time period N (using the clock as the reference). However, I'm having trouble finding a way to convert this signal into a sin wave. What is the best way to convert my square wave of frequency F into a sin wave of frequency F?
Solved! Go to Solution.
04-11-2018 03:19 AM
04-11-2018 04:04 AM
Another option would be to create a look up table with a (quarter of a) sin wave. Then use time as an index in the table. Calculate the proper index and negate the output if you stored a quarter of the sin wave to save FPGA memory. Very old school, but it still works!
04-12-2018 08:03 AM
just wire a VCO.vi and and PLL.vi ... with solder 😄
04-12-2018 08:18 AM
Thanks all. I think I'll just end up using a low pass filter.
04-12-2018 08:34 AM
While I haven't bench-marked it, I suspect you have chosen the worst method to do this. The fastest, certainly, is the simple look-up (or just compute using the Sin function from the Math Palette). Direct, basically one operation per time point, no "approximation", etc.
Bob "IMHO" Schor
04-13-2018 02:42 AM
@Bob_Schor wrote:
While I haven't bench-marked it, I suspect you have chosen the worst method to do this. The fastest, certainly, is the simple look-up (or just compute using the Sin function from the Math Palette). Direct, basically one operation per time point, no "approximation", etc.
Bob "IMHO" Schor
I don't have a FPGA at hand, but does the sine function work on FPGA? I'd think it doesn't, that's why I recommended a LUT.
Some sine wave approximation algorithm (google) might work too.
04-13-2018 03:17 PM
wiebe@CARYA wrote:
@Bob_Schor I don't have a FPGA at hand, but does the sine function work on FPGA? I'd think it doesn't, that's why I recommended a LUT.
Some sine wave approximation algorithm (google) might work too.
Good call. There is a Sin function on FPGA, but not on a RT Platform. I agree that the LUT would be simple and fast -- I used it a few decades ago to generate a Sum-of-Sines "unpredictable" waveform on a PDP-11 ...
Bob Schor
04-16-2018 02:47 AM
@Bob_Schor wrote:
wiebe@CARYA wrote:
@Bob_Schor I don't have a FPGA at hand, but does the sine function work on FPGA? I'd think it doesn't, that's why I recommended a LUT.
Some sine wave approximation algorithm (google) might work too.
Good call. There is a Sin function on FPGA, but not on a RT Platform. I agree that the LUT would be simple and fast -- I used it a few decades ago to generate a Sum-of-Sines "unpredictable" waveform on a PDP-11 ...
Bob Schor
I'd say on RT, you can use the normal Sine function(s) from Mathematics palette?
I used sine LUT's a lot back in the 90's to make C64 demo's\intros (this one is not mine, just the first I could find)!