LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed daqmx task - Help!

Solved!
Go to solution

Hello, 

 

I am looking for some online help on a timed daqmx task.

 

I am trying to run 2 fans using Daq MX tasks for a specific amount of time. The sequence is as follows: 

 

1. Start FAN 1 and run it for 2 minutes. 

2. After the 2 minute time period, STOP FAN 1 and start FAN 2.

3. Run FAN 2 for 3 minutes.

 

I need help incorporating a timer in the task. 

 

I would really appreciate it if the community would shed some insight into this. (Maybe a quick picture of the code ?! ) 

 

Thank You, 

RP. 

0 Kudos
Message 1 of 19
(3,915 Views)

Do you know abou5 the Timing functions (on the Timing Palette)?  Do you understand how Data Flow (a fundamental principle of LabVIEW) works?  Start Task 1, flow data to a 2-minute wait, flow data to turn off Task 1 and start Tast 2, ...

 

Not very elegant, I admit.  Learn more about LabVIEW and you can do this more elegantly.

 

BS

 

P.S. -- next time, post some code to show us that you are making an effort, and not asking us to do all of your work for you.

0 Kudos
Message 2 of 19
(3,887 Views)

Do you know abou5 the Timing functions (on the Timing Palette)?  Do you understand how Data Flow (a fundamental principle of LabVIEW) works?  Start Task 1, flow data to a 2-minute wait, flow data to turn off Task 1 and start Tast 2, ...

 

Not very elegant, I admit.  Learn more about LabVIEW and you can do this more elegantly.

 

BS

 

P.S. -- next time, post some code to show us that you are making an effort, and not asking us to do all of your work for you.

0 Kudos
Message 3 of 19
(3,876 Views)
But do NOT use the Delay or Wait(ms) functions for such long times. They would make your program very unresponsive. Consider the Elapsed Time function.
Message 4 of 19
(3,862 Views)

Bob, 

 

In all humility, I did hear you and i did try that. Had it worked, i wouldn't be here. 

 

As it is lucid, the thread is called timed daqmx task, the question was more towards timing pallete functions(using express delay vis and still expecting programmable effecieny). 

 

RP

 

P.S. - The elegance part is right though, or more like the lack of... 

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

Using Elapsed Time is the better function.  You say it didn't work.  I say post what you tried and we can show you how to make it work.

0 Kudos
Message 6 of 19
(3,844 Views)

Dennis, 

 

I agree, that was more what i was seeking help about; how to get the timing right? 

 

Thank You, 

RP.

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

You have to give a "single command" via DAQmx to start and stop a fan?

If so, this is very simple. Create a state machine. First specify and you can even draw a flow chart. I could imagine the following states:

 

Check GUI (Functions as Idle state also)

Start fan1

Fan1 running

Stop fan1

Start fan2

Fan2 running

Stop fan2

Quit

 

You can either use an event loop with a queued state machine, or you can just simply poll the GUI using a simple state machine.

When the state machine is in the "Fan1 running" or in the "Fan2 running" state, you can bounce between the actual state and the "Check GUI" state in every 10 msec or so. You can use a Functional Global Variable timer (or the Elapsed time Express VI) to check whether the required time has elapsed. If so, you can move on to the next state. In this way the user can also abort any time the system, just create an Abort state for a proper HW stop.

 

 

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

Hi all, 

 

I tried the suggestions, read up on timing functions and was able to make it work with the time elapsed vi.

I am using a NI-9184 chassis with 3 NI-9482 relay modules. And the vi i wrote works well for one NI-9482 module(4 channels) but when i try the channel expansion(syntax et all is right) from 1 module to 3, it does not work. The error code i get are 200086 and mainly 200524 which, imho, think has got to do with "channel in a task to channel in a data balance." 

With my primitive knowledge on labview and with help from the online forums, i tried a few thing like creating an array of channels(lines) and using the flattening function to write to he DAQMXcreatechannel function, creating a task in MAX which includes all the channels from all modules and then wiring it to the Createchannel function - but these things did not work.

One thing I haven't tried yet is wiring the TASK from MAX directly to the DAQMXstart function - hopefully that works. 

 

I would really appreciate it if the community could shed some light into the following:

1. Why i am reading the 200524 error code and maybe point me in the right direction on how i can write digital output from multiple channels on the NI-9482s. 2. Explain what "channel in a task to channel in a data balance really means.

3. How to achieve the right channel expansion.  
 

Much Appreciated, 

RP.

0 Kudos
Message 9 of 19
(3,768 Views)

The first error sounds like each module is a separate device, in which case you need to have a separate task to handle all of the channels on each of those devices.  That why is works when you are trying to use only 1 module, but get errors when using 2 or 3 modules.

 

Are you programming in another language and your error message is a translation?  The ""channel in a task to channel in a data balance" doesn't make sense and sounds like a bad translation to English.  When I look up error -200524, I get

 

"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. Alternatively, modify the task to contain the same number of channels as the data written.

"

That means to me that you have you are trying to write data for X number of channels, but your task has a different number of channels.  You need to make sure the size of the array you write matches the number of channels you defined in the task.

0 Kudos
Message 10 of 19
(3,753 Views)