PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I generate a stable square wave from a digital line using the PXI-6289?

I have been trying to use LabVIEW to generate a square wave using the digital lines on a PXI-6289 card.  I have tried using both a loop and the millisecond counter, but neither result was stable.  I request a 200Hz wave, but the frequency varies between 10Hz and 100Hz.  The examples that I have found either use a counter output or require an external trigger.  I found one example VI that generates a stable output on an analog channel, but I only have one of those channels available and I need 4.  It seemed like a simple job when I started, but I guess I was wrong.  Any helpful suggestions out there?
0 Kudos
Message 1 of 5
(4,843 Views)
It sounds like you've been trying to setup the timing for your digital output using software.  Because of the non-deterministic nature of most operating systems wou will not be able to have accurately timed I/O if you use this method.  You need to use hardware timing instead.

The DIO on the 6289 is capable of rates up to 10MHz if correlated with an external clock.  It is common to setup a counter output task to generate a pulse trane and specify the sample clock source for the DIO as ctr0InternalOutput.  The counter serves as the external clock for the digital output, which allows you to setup your DIO task using hardware timing.

Check out this great example on correlated DIO:
Performing Correlated Digital IO with an M Series Device in LabVIEW

And let me know if you have any further questions!
Elijah Kerry
NI Director, Software Community
0 Kudos
Message 2 of 5
(4,832 Views)
Elijah,
 
Thanks for your response.  Unfortunately, my counter outputs are not accessible because I am using the first connector on the PXI-6289 to connect to an extension SCXI chassis.  I was told that the extension needs to use the first connector in order to work.  Even so, if I'm not mistaken, there are only two counter outputs on the PXI-6289 and I require four.
 
All that said, I seem to have found a satisfactory solution by moving my timing code to a completely seperate loop.  The result is not precisely timed, but it seems to do well enough for my application.  Still, I would be glad to try a better solution if one is available.
 
Thanks again.
0 Kudos
Message 3 of 5
(4,822 Views)

I want to drive a DAC using a DIO lines of PXI-6289, i am facing some problem as :

1. as it does not have it's won timing engine where to source the external clock?

2. will it be possible to generate different SPI pattern from different DIO channels form PORT-0 of PXI 6289?

Please help ASAP.

 

Thanks

Sanjay 

0 Kudos
Message 4 of 5
(2,467 Views)

Hi Sanjay,

 

As this thread is over ten years old, I suggest creating a new thread. This will help you get more responses.

 

You should be able to use an onboard clock with this application.  For the digital task, you will need to create a control (or constant) for the "source" input on the DAQmx Timing VI and choose "Devx/ai/sampleclock"   What this does is routes the internal sample clock being used by the analog input task to your digital output task. This is known as "Correlated DIO" and there are many threads and resources covering this topic. 

 

Explore this thread on generating SPI waveforms: https://forums.ni.com/t5/Digital-I-O/generate-SPI-waveform-with-cDaq9174-and-NI-9401-to-test-SPI/td-...

 

 

 

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