Discussion:
How can I have 2 tasks at the same time in one NI 9401 DIO module?
(too old to reply)
muslim
2008-06-06 09:10:07 UTC
Permalink
Salam,
I am working on a simple project were I have to,
1. Generate a TTL square pulse of about 1-2 Hz using an NI 9401 DIO module. 
2. Count pulses using NI 9401 DIO module.
3. And Trun on an LED when the count reaches 100 pulses at the counter.
Therefore I am using a cDAQ 9172 chassis, with 2 DIO modules. one is the generator and one is the counter.
The problem I'm facing is that I can't have another DAQ Asst in my vi, because LabVIEW will show an error stating that the module is reserved.
So far I got both, the generator and the counter working. remaining is the LED control to turn on after 100pulses are counted.
 
Any help?
muslim
2008-06-06 09:10:07 UTC
Permalink
This is the vi if u wanna have a look.
Thanks.


vi.JPG:
Loading Image...


new qz.vi:
http://forums.ni.com/attachments/ni/70/8977/2/new qz.vi
MarkGrot
2008-06-06 16:10:08 UTC
Permalink
The NI 9401's direction is nibble configurable but not while the module is in use.  This means you need to configure the device prior to starting any tasks on it.  This isn't possible only using the DAQ Assistant but you can use it as a starting block.  If you right click on the DAQ Assistant blocks in Labview, you can select "Generate DAQmx Code".  This will transform the DAQ Assistant block into its underlying DAQmx calls.  Do this for both DAQ Assistant blocks.

You'll need to pull the configuration VIs out of their while loops (they are the untitled generated VIs).  Insert a DAQmx Control Task VI (DAQmx->DAQmxAdvanced Task Options) after each configuration VI and set the action to reserve.  You will then need to force the execution order to reserve both tasks before starting or entering either while loop.  You can do this with a sequence structure or by wiring the error output of the Control Task VI into the other task to create a dependency.

You might want to see <a href="http://forums.ni.com/ni/board/message?board.id=70&amp;message.id=8304" target="_blank">this thread</a> for reference.&nbsp; If I get a chance later today I'll make a quick VI.
Message Edited by MarkGrot on 06-06-2008 11:06 AM

Loading...