LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger analog input in Labview FPGA

Solved!
Go to solution

After a day testing the code, it has it's problems. But I don't  understand why the sine is quantizied (see attachments). And I can't set the trigger level to decimals either. I want to set the level to 0.65, but then it just coerce the number to 1.

 

Regards,

Tim

0 Kudos
Message 11 of 17
(2,061 Views)

I think it has something to do with FXP. Do I need to convert the FXP to something else?

Message Edited by MightyEKA on 11-06-2009 02:50 AM
0 Kudos
Message 12 of 17
(2,052 Views)

Hello Tim,

Yes, the FXP should be converted to a DBL or SGL and then you can create your waveform. Also the results can be due to the sampling rate and such (aliasing, undersampling and oversampling). We might also have errors when converting FXP to DBLs depending on how we have specified the FXP. Attached is a complete project you can compile for your target. Use the application called "Host no HW" on the cRIO controller and the "FPGA no HW" on the FPGA. Play around with the sampling rate (i.e. acquisition rate of your acquisition on the FPGA) and the amplitude/frequency controls (for the sine wave generation) to see the effects on sampling rates and frequencies generated (you could also change the loop rate of the timed loop in the cRIO application). Don't forget the Kudos!

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

Message 13 of 17
(2,043 Views)

Is it possible to open the files in LV 8.6? The thing is that I don't have the FGPA module installed on the computer with LV 2009!

 

Regards,

Tim

0 Kudos
Message 14 of 17
(2,039 Views)

Hello again,

Here you go, attached is the code in 8.6 format. There might be one VI missing or so that are new for LV2009 but you should be able to replace them easily with your own. The sample rate on the FPGA (acquisition rate) is expressed in ticks. I.e. 1 Hz corresponds to 40M ticks, 2 Hz to 20M ticks and so on.

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

Message 15 of 17
(2,025 Views)

Hello again!

I've been using your examples a lot and have now built a "new" code (using old ones and made some new "improvements"). Since I needed to use the project in many different ways, I removed the "Read-the-samples-and-then-quit-function" and am now using ms as a stop function. But I'm still working on how to make it work in a greater amount of milliseconds. Right now, at 10 kS/s, I can make it run for approximately 25 seconds.

 

Anyways, it works in a decent way now. But I'm a bit confused when talking about picking the sampling rate. The Nyquist rate doesn't seem to work here. If I set the sample frequency to 2*Fa (signal frequency), the sampled signal gets real messed up. Is it really true that:

 

"It is always safest and easiest to pick7 a sampling frequency well above the highest anticipated fre-quency. A factor of ten to hundred times higher provides a comfortable margin."

 

That sounds like a real waste of frequency?

 

I attach my new code, as well.

 

Regards,

Tim Jansson

Message Edited by MightyEKA on 11-12-2009 04:06 AM
0 Kudos
Message 16 of 17
(2,003 Views)

I forgot to add the host vi...of course...

0 Kudos
Message 17 of 17
(1,988 Views)