10-11-2008 02:28 AM
Hi
I have a very basic question which I do not seem to find the answer to though.
When programming a VI for measurement and control using a standard DAQ device, for example 6281 I
often want to control the same digital out pin from various places in the program.
F.ex. In the beginning I want P0,0 to be high, then later somewhere deep in the program in a while loop I want
to set P0,0 to low. How do I do this. I keep getting the message that the resource is reserved.
This I have the same question with AI, AO and Digital in.
The DAQassistant does not work and doing this more manually by creating a task, stopping it and clearing it has been problematic.
Can anyone help? Hopefully with a demonstration VI if you have it?
Thanks for reading all the way down though;)
10-11-2008 01:41 PM - edited 10-11-2008 01:42 PM
You should create a functional global that stores tasks for each port.
In the following image I have some code that should work.
It looks up the addressed port and creates a new task if needed, otherwise it will call the old task.
Be sure to call this VI with 'Stop?'=True at the end of your program.
Ton
10-15-2008 01:43 AM
Thanks TonP
I see your point but I don't think you are seeing mine;)
Wether it is AI, AO, DI, or DO is actually beside the point concerning my question, I am just wondering if identical acquisition can exist in various locations in a block diagram.
I know it can but I don't know if that is the right or "legal" way to program in Labview. I attached an example which I extracted from an old program of mine.
There a task is created, ai2 is measured then the task is stopped and cleared, in the following the sequence the same is repeated, I needed to measure the same channel at multiple locations in my program and it worked, sometimes I got an error though and I am wondering if this could be the reason? (I don´t remember the name of the error)
Hope somebody understands my strangely written question:)
10-15-2008 01:54 AM
10-16-2008 01:03 PM - edited 10-16-2008 01:04 PM
I see what you mean.
My previous VI was purely meant for demonstartion, and works best for DI and DO.
By the way the program you posted should never give an error, if you get one report it to NI.
Here's the code a little bit altered. It is important to think in tasks:

Ton
10-18-2008 02:04 AM
Thanks man, that is exactly the answer I was hoping/looking for:)
and also thanks for the task tip,,, appreciated!
Ice_man