03-12-2012 03:42 PM
I am writing LabVIEW code to control a conversion process for up to 4 devices on one apparatus.
The operator will select from these 4 devices which ones will go through a conversion process. Therefore - they can select some or all of the devices to go through the process. The process is the same for all 4 devices. The difference between the 4 are the digital outputs used for the conversion process.
Clearly a state machine is applicable. However, I would like to "reuse" the process conversion code of the state machine by creating a separate recipe for each device and merely change the digital outputs (their physical location) for the device under conversion. Presently I have DAQ Assistants controlling digital ouputs for the conversion of one device. Is it possible to "reuse" the code by creating a recipe or a lookup table to reassign the DAQ Assistants to their proper physical location (the digital output lines) for the device under conversion?
I could - copy and paste the code, go into the process and reassign every DAQ Assistant to the correct physical channel of each digital output for the other 3 devices. I was curious if there was a more efficient way.
I see documentation online for recipes; however they are dated 2006. I thought there may be some updated examples.
Using:
LabVIEW 2011
cDAQ-9188 chassis
03-13-2012 09:08 PM
Hi MgDAQ,
DAQ Assistant is a quick way to start acquiring data, however it's not the most efficient.
Everything that DAQ Assistant does can be acompished with basic DAQ functions on the
Measurement I/O -> NI-DAQmx pallete. For example, you can use DAQmx-Create Channel.vi and
a Channel Constant to select the channel from which you want to acquire data.
To get started with using the DAQmx functions you can browse through Hardware I/O examples in the Example Finder.
Open up a new LabVIEW VI and then go to Help -> Find Examples -> Hardware Input and Output [folder] -> DAQmx -> Digital Measurements
Now, as you probably know, copying and pasting code is inefficient and it's not a good programming practice. So what I would do is create the code for your conversion process and then simply change the channel constant to read the digital output you need.