Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I eliminate jitter in AO generated square waves?

I am using a PXI-6289 to generate two square waves.  On the block diagram I utilize two of the Function Generator VI's to create the square waves.  The outputs are sent to a build array node the output of which is connected to a DAQ Assistant node, and it is all contained in a while loop..  Also inside the while loop are front panel controls for adjusting amplitude, phase, and offset of the output for each of the function generator VI's.  Everything works fine as long as the phase controls are set to zero phase.  But when I set either of the phase controls to a value other than 0, about 1 microsecond of jitter begins to occur in one of the waveforms (the waveform that is not used to trigger the oscilloscope on which the waveforms are being observed).   I am attaching to image files that show the waveforms on the oscilloscope.  The upper waveform is used to trigger the scope.  The lower waveform exhibits the jitter. The leading edge of the lower waveform jumps back and forth between the two positions shown.  I would like to know how to eliminate the jitter. 
0 Kudos
Message 1 of 6
(3,567 Views)

epsilon,

 

I think you meant to attach 2 images?  Could you also attach a screenshot of you Block Diagram or the VI itself?

 

When you run an example program do you see this same behaviour?

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 2 of 6
(3,549 Views)
You're right.  Here is the second photo.  I discovered a way around this problem, but the solution has a new problem.  I created a new VI that uses two Simulate Signal nodes, each generating a squarewave output.  I ran their outputs to a merge signal node and the output of that to a Daq Assistant node.  And all of that inside a while loop.  That fixed the jitter problem, and now I can change the phase between the squarewaves while the program is running.  The new problem is that the phase can only be implemented in increments of about 4 degrees.  For example, If I enter 1, 2, or 3 for the phase value, no shift between the waveforms is seen.  If I enter 4 for the phase shift, a phase shift appears.  If I keep incrementing the phase value by 1, no further phase shift is seen until I enter a value of 8 for the phase shift.  The next phase shift after tha occurs at a phase value of 11.  I need to have finer resolution control over t he phase shift.  I am attaching my VI.
Download All
0 Kudos
Message 3 of 6
(3,546 Views)

Epsilon,

 

I wrote a program exactly like this a while back.  It generates 3 signals of any type (sine, square, triangle, etc) and at any phase.  You can find it here:

http://decibel.ni.com/content/docs/DOC-2289

 

The reason you are probably getting this poor phase resolution is either due to using express VIs which are intended to be quick but not the most efficent or best for more complex applications or the fact that we want to have a property called non-regeneration on.  Either way I think the VI I linked above should work perfectly.

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 4 of 6
(3,519 Views)

Hello Jason,

 

I downloaded your VI and tried to run it, but an error appeared:

 

Error -200524 occurred at DAQmx Write (Analog 1D Wfm NChan NSamp).vi:1

Measurements: Write cannot be performed because the number of channels in the data does not match the number of channels in the task. 

 

When writing, supply data for all channels in the task.  Alternately, modify the task to contain the same number of channels as the data written. 

 

Number of Channels in Task: 1

Number of Channels in Data: 3

 

Task Name:_unnamedTask<3>

 

 I want to reiterate what I am trying to do.  I want to use two output channels of the PXI-6289 to produce two waveforms simultaneously (on channels ao2 and ao3), and be able to adjust the phase shift between the two waveforms while the VI is running.  Your program seems to have only one output channel selectable at a time.  Am I missing something?

 

 

 

 

 

0 Kudos
Message 5 of 6
(3,507 Views)

Epsilon,

 

Sorry I should have been more detailed and specific.  When wanting to use multiple channels the proper way to do it (seen in this VI) is to group them into one task and then reference all of them in the same Device box.  Yours should look like:

 

\Dev1\ao1:3 which will reference the channels 1 through 3.  Dev1 is merely an example and should be tailored to the location of your device.  An alternative to typing this in is to click the drop down box then click Browse and highlight the channels in question using ctrl to select multiple.

 

Finally if you only need 2 channels you will need to trim out the 3rd part of the program.

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 6 of 6
(3,500 Views)