LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Task Management/Timed Sequence in DAQmx

Hello, I'm new to the forum and can't identify what I am misunderstanding. I've been searching and reading up on this but can't seem to find the knowledge gap.

 

I have a 9401 module in a CompactDAQ chassis outputting 8 different digital high/low signals controlled by a Boolean button array in the front panel. It is based on the simple example VI for DAQmx found in:

 

":\Program Files\National Instruments\LabVIEW 2018\examples\DAQmx\Digital Output"

 

This is great for sending on/off digital signals, however, I want to be able to configure multiple "states" for the DIO port. For example, state1 would have a number of channels in the on/off position and would change to a different configuration in state2. It is my understanding that I would need to set up a separate "task" for each digital state, but I run into 200022 errors saying "this task has already been reserved by a different task."

 

My problem here is not understanding how to manage the tasks for the same single DAQ module. I've seen that tasks can be managed in the Flat Sequence Structure, but is still rather unclear to me. I basically want to have 3-5 tasks on one digital out module that execute different outputs in a timed sequence while being able to control the time between each task.

 

Can anyone please point me in the right direction so I can figure out what I am not understanding? Thank you.

0 Kudos
Message 1 of 5
(2,101 Views)

I'm not familiar with this particular module, but other Digital I/O devices I've used have had the ability to write lines or ports (where, if I have the terminology right, a Port is a set of 2-8 Lines = bits).  You can configure a task that deals with Ports, potentially changing all 8 Lines in a single Task.  If on a particular "tick", a Line doesn't change, then don't change it!  Now you have one task, each Line can vary independently, and you only have to manipulate bits in a Byte (pretty simple).

 

Or am I missing something?  (Wouldn't be the first time ...).

 

Bob Schor

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

Hi Bob. My nomenclature isn't very good so let me be clear. I have the task on this device set to control the whole port with a Boolean array. All 8 lines on the port are controlled by the single task.

 

I can easily modify the output on each line of the port by clicking on the Boolean array buttons in the front panel.

 

What I want to do is create a second task with a second boolean array that tells the module to write a different set of data. The problem I am having is not understanding how to set up the second task to either run in sequence or on command.

0 Kudos
Message 3 of 5
(2,078 Views)

The "state" of the DIO port is defined by the *data* you write to it.   (And access to the port is mediated by the task.)

 

I think what you aren't understanding is that you only need 1 task to get access to the port, then you can change the port "state" any number of times you want simply by writing a different array of boolean data to the 1 task.   The screenshot you posted looks like it's already doing that.   The problem is that the digital port state changes immediately when you change a value on the GUI.  You want more control over the state changes, such as time delays between changes and the ability to change multiple lines simultaneously.

 

For *that*, I'd suggest you do some searching on the idea of a "state machine".

 

 

-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 4 of 5
(2,074 Views)

Thanks Kevin, I'll look into the state machine architecture but I think that's more complicated than I require...I just need to figure out how to implement a time delay between each subsequent Write command in the single task. I am trying to figure out if this can be done using DAQmx functions achieve this or if I have to use something else like a Timed Sequence structure.

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