LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[FPGA] Problem with Sine Wave generator

Solved!
Go to solution

Hello!

 

At the beginning I would like to apologize for my english, it is not my native language.

 

Software and hardware I am using is:

LabVIEW 8.5

NI RIO 2.4.1

NI cRIO-9014 (CompactRIO Real-Time Controller)

NI cRIO-9104 (FPGA and chassis)

NI 9264 (16-Channel, +-10V, 16-Bit Analog Voltage Output Module)

 

I have made a very simple FPGA VI: a while loop, Sine Wave Generator and a FPGA I/O Node in the loop. I specified parameters of the Gnerator in following way:

Frequency = 50Hz
Amplitude = 1
Phase offset = 0,00
Look-up table size = 1024
Amplitude resolution = 16 bit

FPGA clock rate (40MHz)

 

But the "sine" wave I got is not what I wanted to get. First of all, its amplitude is 1 V. Shouldn't it be encoded on 16 bits? If I wanted to get 1V I should have specified Amplitude as a 3277. Moreover, the "sine" is not a detailed one, it is looking like "steps", like a lot of samples vere missing. What I did wrong? I have checked examples and tutorials, I did everything the same way. Did I forgot about something or didn't specify some other parameters?

 

Many thanks for Your help!

0 Kudos
Message 1 of 5
(5,731 Views)

Ok, I have found a solution to the amplitude problem: change the Calibration Mode in Module Configuration of the analog ouput to Raw.

 

But I still have a problems with samples. Sine wave looks really crude... 😞 Any ideas? I will be extremely grateful for any help 🙂

0 Kudos
Message 2 of 5
(5,713 Views)

It looks like the 9264 has an output rate of 25 kS/s, which means your loop is probably running a bit slower than that. At 50 Hz, you would expect to see 500 samples (steps) per cycle in your output waveform. If you're seeing less than that, most likely your loop is running too slowly. Use shift registers to parallelize your code, making sure that the IO node is fed directly from a shift register.

 

If that doesn't help, please include your code so we can see how you're using it.

 

Jim

Message 3 of 5
(5,697 Views)
Solution
Accepted by topic author qkieu

Ok, I have solved a problem. It is embarrasing to admit but maybe it will help someone else 😛 I blame my inexperience 🙂

 

The main solution of the whole problem was changing Calibration Mode to Raw from Calibrated. After this, everythoing works as intended. I had a problems with sampling because I was using a multiplier to control an amplitude of the generated Sine Wave. But... It was setted to 1 in Sine Wave Generator. That was the reason for stepped waveform. Please, do not laugh too much 😉

 

Anyhow, thanks for a reply! It is solved now 😉

0 Kudos
Message 4 of 5
(5,677 Views)

Hello,

 

 

 I am also facing the same problem. However as per your suggestion I am tring to find out the where to change from calibration mode to raw mode.

Can anybody please tell me how to find out that?

 

Thanks.

0 Kudos
Message 5 of 5
(5,431 Views)