02-11-2011 02:40 PM
Hey,
The purpose of my VI is to generate an impulse with a PXI-5412 FGEN from a saved binary file.
To do so, I created a basic function in Matlab and saved it as a 64-bit double floating point (big-endian). As my LabVIEW VI works right now, it reads the correct file and converts it to a waveform. However, instead of just generating the waveform once and waiting 50ms as I would expect it to, it generates a number of waveforms in succession then waits 50ms. Over a relatively long period of time, those sequences of waveforms look like impulses, but that's not what I'm looking for.
Furthermore, the value between those "impulses" is inconsistent and does not always return to zero. Is my program not clearing correctly or not finishing a cycle?
I appreciate your help,
Marc
02-11-2011 02:51 PM
Here is my VI I'm using. For some reason I can't attach my binary signal, but here's my Matlab code.
a=0:999;
f=[0.0001.*a.*sin((a/50)*pi)];
fid=fopen('signal.dat','wb');
fwrite(fid,f,'double',0,'b'b);
fclose(fid);
02-16-2011 11:55 AM - edited 02-16-2011 11:56 AM
Hello There,
The niFgen Abort Generation.vi is typically placed after the generation and not prior to. A good example of the flow of processes involved when using function generators can be found by navigating to Start » All Programs » National Instruments » NI-FGEN » Examples and open Fgen Create From File (I16).vi. My next suggestion is to use scripting rather than the for loop with the software wait function. An advantage of using scripting is that the output will be more deterministic in comparison to your current implementation. An example that uses the scripting functionality can be located by navigating to Start » All Programs » National Instruments » NI-FGEN » Examples and open Fgen Switch Between Waveforms.vi. The scripting tool lets you do wait functions which is probably what you want to use. In particular, you may want to explore the Finite Repetition (N Times) script or Finite Wait script. These example scripts can be found after launching the NI Script Editor, Start » All Programs » National Instruments » NI-FGEN » Script Editor. Then, select Help » NI Script Editor Help. The example scripts can be located by expanding NI Script Editor Help » Programming Generation Sequence Using Scripting » Common Scripting Use Cases. I hope this helps.