08-13-2012 09:08 AM
I am using a NI cDAQ-9178 with an NI 9472 DO module. I need to set one of the bits high for 1 second, but do not want the program to pause for that second. I have created a DAQmx task that will do this, and when I run it in MAX it works perfectly. I cannot figure out how to call this task programatically. The attached error image shows both how I am trying to call it, and the error message I am getting.
08-13-2012 12:00 PM
Hi Imtis,
In order for you to generate a digital signal using DAQmx you have to set-up and start a Digital Output task using the functions from the DAQmx pallette in LabVIEW. Alternatively you can use the DAQ Assistant Express VI if you don't require the flexibility of the low-level functions and want to set up a simple task.
If you wanted to use low-level functions you would need to add the DAQmx Write function to the Start Task function that you are currently using. You could also include the Timing function to configure sampling rates etc.
It is good practise to use the Clear Task function after you have acquired or generated your data to free up your hardware resources.
There are some good examples of digital output generation in the LabVIEW Example Finder. Browse to Hardware Input and Output >> DAQmx >> Digital Generation and experiment with the examples. Hopefully you should find something close to what you are trying to achieve.
If you have any further questions I'll be more than happy to help.
08-13-2012 02:08 PM
Hi Jamie,
Thanks for your reply. I am trying to write an application that will simultaneously operate 4 test stations. To trigger each test cycle I need to output a one second DO pulse. What I was hoping that I could do is initiate a task that the cDAQ chassis would do independantly with onboard timers so that my program could be collecting data while that one digital channel was being manipulated if you get my drift. I can do everything serially if I need to, but would prefer to not have the periodic 1 second gaps in data collection.
08-13-2012 03:56 PM
The DAQmx Task you have configured does not do exactly what you think it does. It doesn't actually generate any data; the alternating 0/1 pattern is just a test pattern within MAX and is not part of the task. You need to write the data to the task prior to running it, as suggested by the error message (actually, you can just write it to the task with the Auto-Start input set to True and skip the Start Task). The appropriate data will be a 3-element array of booleans, set to FALSE-TRUE-FALSE.
08-14-2012 05:39 AM
Hi Jim,
nathand is completely correct in that your MAX task is just a test pattern and cannot be used programatically in your .vi to generate the data.
I have a better understanding of what you are trying to achieve now however I'm still unsure why you are encountering the 1 second delay without some more information..
I should be able to offer some more advice if I know how the Hardware is set up e.g. Which Chassis and Modules you are using and briefly their purpose in your application?
Regards