From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PXIe-6341 X-Series - Drive digital output and pulse on the same line

Solved!
Go to solution

Hi,

 

I'm working on an application that requires me to be able to individually drive some digital inputs high and low while performing some measurements on a UUT. This digital channel driving is handled manually; for example, I drive a channel high, perform some actions/measurements on the UUT, and drive the channel low again as needed. However, part of the requirement is now for those same channels to also be pulsed (single pulse high for 50ms for example). I had previously been using a PXI-6509 for these digital operations but then the need came to do some pulsing so I upgraded to the PXIe-6341 which has built in counters. The pulse spec has to be pretty accurate and deterministic so instead of trying a software timing setup I am using this. 

 

My main question is am I able to treat the digital IO lines on the 6341 as both DIO and counter lines? Put another way, am I able to continue manually driving digital lines but then pulse those same digital lines (using a counter reference) or do I have to use separate "counter" output lines for these pulses? I'd rather not have to run another line to the same test point where one is for manual digital operations and the other is merely for pulsing, if that makes sense.

 

If I am able to, how would I setup the channels differently from normal DIO lines?

0 Kudos
Message 1 of 9
(4,117 Views)

Hello rdp08LM

 

I would like to make sure if I understood correctly. What you would like to do is performing the same pulses you had and switch for a different pulse frequency, Am I right? Feel free to correct me if I am wrong.

 

Regards 

0 Kudos
Message 2 of 9
(4,062 Views)

There are three digital ports on the PXIe-6341 (and all X Series devices).  Ports 0, 1 and 2.

 

Port 0 can be used for the following output types:

Software timed (this is equivalent to what the 6509 can do)

Hardware timed (max sample clock rate of 1 MHz).

You can use port zero in the same manner in which are currently using your 6509.  Additionally, you can use hardware timed output to generate timed pulses if microsecond resolution is sufficient for your application.  For you example of a 50 ms pulse, you run your digital output with a 1 kHz sample clock, call DAQmx write with data as follows: a single 'low' sample, followed by 50 'high' samples, followed by another 'low' sample.  You use your sample clock rate and number of samples to control your pulse width.  In this example, a 1 kHz sample clock gives you millisecond resolution on pulse width, but you can get better resolution increasing your sample clock rate.

 

Port 1 and 2 can do the following:

Software timed (equivalent to what the 6509 can do)

PFI functionality - can be the output terminals for counter tasks, which can be used to create pulses with 10 nanosecond resolution.  Note, there are four counter available on the PXIe-6341, so this will limit the number of timed pulses you can generate at the same time to four.  To generate a 50 ms pulse here (say port1/line0), you'd create a counter output pulse generation task, set its 'high time' to be 50 ms, and set its output terminal to be PFI0.  Note, you may have to be careful in how you configure your tasks to ensure no glitch occurs on the line when you switch between digital output and counter tasks.

 

Hope that helps,

Dan

0 Kudos
Message 3 of 9
(4,061 Views)

Hi David22JRA,

 

I would like to be able to switch from static pulsing (manual, no timing) to timed pulses (i.e. 50ms pulse) on the fly. I am controlling this in TestStand where for example I need to drive a pin high, leave it high while other measurements are performed, and drive it low again. Then, in another measurement, pulse that same pin with hardware timing.

 

Thanks.

0 Kudos
Message 4 of 9
(4,040 Views)

Hi Mcdan,

 

Thanks, your post is very helpful to understand the different possible approaches.

 

Approach 1:

I believe I understand this approach. I didn't consider this but I will give this a try.

 

Approach 2:

This is the approach I was wondering about. It sounds like you are saying that it is possible to use a single PFI line to both statically drive digital outputs as well as to pulse with a counter, which would make sense. However, in terms of implementing something like this, is a single PFI line able to have multiple tasks open on it? For reference, I'm writing a TestStand sequence where I need to statically drive a line high while some measurements are done, drive it low again, and then later pulse the same line (in my example, 50ms high) for some other measurements. If I open two tasks, a static DO task and a counter task, and manage them, am I able to just feed the task I need at the time to the line?

 

Thanks.

0 Kudos
Message 5 of 9
(4,037 Views)

I'd try to use the counters for both scenarios if you need 4 or fewer output signals.

 

To make a counter "act like" a static DIO output, configure it with a minimal initial delay and an "engineering infinite" high time.  Start the task to set the output high, stop the task to set it back low.   You may need to explicitly specify use of the slowest available internal timebase (probably 100 kHz) to support the longest possible high time.   If this is somehow still not long enough, there are options to have these counters be pause-triggered by a PFI line that you can control via static DIO.

 

 

-Kevin P

 

 

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 9
(4,028 Views)
Solution
Accepted by topic author rdp08LM

You may be able to get a counter to act like a static DIO simply by setting the idle state state and output terminal and committing the task.  I'm not sure you actually need to start a task to get this behavior.

 

Dan

Message 7 of 9
(4,021 Views)

I did a quick test on Mcdan's suggestion and it seems to work.  You'll need to use 'DAQmx Control Task.vi' (found on the DAQmx Advanced Task Options palette) to manipulate the operational state of the counter task.   You should only need to use the "verify" and "commit" actions.  You'll also need a DAQmx Channel property node to manipulate the counter task's output idle state.

 

To toggle the output high, set the task state to "verify", configure idle state "High", and set the task state to "commit".  To toggle the output low, do the same sequence but set idle state "Low".

 

When you need to generate a precision-timed real pulse, set the task state to "verify", configure pulse parameters, and start the task.

 

All that being said, I'd still probably opt for my idea of starting and stopping an extra long pulse *IF* you can be sure the timing always works, i.e., you'll always be manually stopping the task before the pulse ends.

 

 

- Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 9
(3,999 Views)

I did a test case on this approach and it worked beautifully.

 

Definitely a bit of a convoluted method to do something seemingly so simple, but at least it is working. I built a state machine to create the tasks I need and pass them to TestStand to manage. I only needed 4 pins and so I assigned a separate counter to each pin. I created each task with the appropriate pulse width upon creation. To statically drive I use this approach and set the idle state, verify, and commit. Then when I need to pulse I just start the task, wait for completion, then stop. Works great. 

 

Thanks!

0 Kudos
Message 9 of 9
(3,973 Views)