LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 6251 to sequentially output digital signal

Solved!
Go to solution

I have the NI PCI-6251 card and want to sequentially produce a digital output for the two counter channels. Specifically, I want one counter to be high for 200ms, then low, wait for 10µs, then set counter two to high for 200ms, before waiting again 10µs. This cycle should repeat. Each cycle therefor takes (200+0.01+200+0.01)=400.02ms. 

In MAX, I have configured the task so that ctr0 takes the role of counter one while ctr1 takes the role of counter two. 6251 only has two counters. Unfortuanetly I am not seeing a signal on the oscilloscope...
Is my understanding of what the counters are supposed to do correct? Also, In the "Configuration" tab for the task in MAX, it says that the output terminal for both counters should be PFI13...? How are two counters supposed to run of the same terminal?

I'm not sure if I'm understanding the counters correctly.

Many thanks

0 Kudos
Message 1 of 19
(4,001 Views)

Hello dougbockILT,

 

my idea is to build a waveform and to put this out, then you need only one counter and you can generate the pulses in the way you want. For the X-Series you do not need an additional counter, for the M-Series the counter is used to make a PWM that drive the clock for the DIO out.

 

idea.png

 

It is always helpful to post the vi you use, or screenshots from the setting. Thanks.

 

Hope my idea helps.

best regards
Alexander
Message 2 of 19
(3,957 Views)

I am trying to achieve the output shown in the "pulsetrain.png" image: basically, two digital channels that are set to high one after the other with some time in between them.

 

I am having a really hard time implementing this! The catch is that I want this to be hardware timed, i.e. without the use of a, say, state machine.

 

I am using the NI PCIe-6251, which has two counters built in, along with plenty of DIO and PFI channels. The attached .vi is my best guess at how this should work. But I dont understand how to incorporate the pulses...? How do I tell the digital outputs to stay high for 200 ms? I understand that the second output can simply be offset by a delay of 200.01ms to achieve the sequential pulses.

Many thanks

 

EDIT: The reason I want this to be hardware timed is that later on I wish to simultaneously activate AI channels. That is, when DO/0 is high, AI/0 is active, and when DO/1 is high, AI/1 is active.

Download All
0 Kudos
Message 3 of 19
(3,960 Views)

Hi doug,

 

why do you (try to) create a new thread for the same old problem? Stick with one thread please!

 

What's wrong with using (digital) waveforms to solve your problem?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 19
(3,951 Views)

I figured maybe my original threas was to specific. Turns out someone answered while I was typing out this new one. 
I do not want to use waveforms for the reasons specified in the EDIT. It seems like using waveforms will make the implementation of this more difficult. Also I want the hardware to be doing the bulk of the control as I will be doing quite heavy coumputations witht he AI data.

0 Kudos
Message 5 of 19
(3,946 Views)

Hi doug,

 

It seems like using waveforms will make the implementation of this more difficult.

Where exactly?

You create the waveforms you want to output - then the hardware will output them with the specified sample rate.

So again: what's wrong with the suggestion you already got?

 

Also I want the hardware to be doing the bulk of the control as I will be doing quite heavy coumputations witht he AI data.

There is NO computational load while outputting the DO signals!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 19
(3,942 Views)

Hello dougbockILT

 

in my example you only configure the waveform during the start process. You can also use an array of values for controlling the DIO port you want. The output is done in hardware and it is not software timed.

0 Kudos
Message 7 of 19
(3,941 Views)

I have tried to adapt Duffy2007's vi to my requirements and have maxed out my memory in the process...now I have a question:

 

Duffy2007's idea is to have a 1D array for each channel containing bool values. That means for a HIGH pulse of 200ms followed by a LOW for 10µs, this array should be T...TF...F, with the number of T's and F's depending on the sampling rate. 


(For 1,000Hz: 200 x T followed by 0 x F, since 10µs is too fast for this sampling rate => array length of 1,000 elements containing 5 HIGH pulses.
For 1,000,000 HZ: 200,000 x T followed by 10 x F => array length of 1,000,000 containing 5 HIGH pulses.)

So straightaway we see that memory becomes a huge factor for large sampling rates. This is WITHOUT EVEN considering that I need this to be repetitive, that is, several of these arrays one after the other. Unless of course there is some way of telling the hardware to repeat the same waveform over and over again. Also, double this for the other DO channel...

 

This is why the waveform solution seems not appropriate here.

 

I get the feeling that I am overlooking something really simple or am just not explaining my problem well enough...

0 Kudos
Message 8 of 19
(3,911 Views)

Hi doug,

 

- you can join both DO channels into one task.

- you can output U8 values to set both DO channels with just one value ("port" writing instead of "channel" writing)

With your requirements I would use a samplerate of 100kHz…

 

Btw. there are also example VIs explaining how to output large waveforms through DAQmx!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 19
(3,908 Views)

Hello dougbockILT

 

a different idea is to run two PWM start the slave with the trigger from the master, but with an delay.

idea2.png

 

 

 

best regards
Alexander
Message 10 of 19
(3,904 Views)