08-02-2023 02:38 PM
I am working on some code we got from France and I am not understanding what is actually going on in this. We are taking the Max DAQmx tasks and changing it to programmatically create them due to some issues we are having. I just don't understand what is happening here and how I can programmatically do this. I have never experienced using the DAQmx Flatten Channel String.vi What is it doing in this situation? How do I create this programmatically? TIA
08-02-2023 02:43 PM
DAQmx flatten string is just a fancy way to convert the array into comma separated string.
08-02-2023 02:46 PM
Hi Sam,
@801Sam wrote:
I have never experienced using the DAQmx Flatten Channel String.vi What is it doing in this situation? How do I create this programmatically?
It flattens te given list/array of channels into a string containing all channels in expected formatting - as described in the help for this function!
The context help says:
Converts an array of physical or virtual channel names to a comma-delimited list of names. You can use this VI to convert an array of channel names to a single string prior to using the DAQmx Create Virtual Channel VI or the DAQmx Create Task VI.
08-02-2023 03:01 PM
Yes, Thank you. I read the help. Does doing this combine the two channels? I need to figure out how to do this through programming. I tried creating the two channels then flattening them. I got this error. Why I am not trying to use the MAX Tasks is the pc I have this code running on has only the executable and for some reason tasks are not working on it. So, I found online where it said some MAX tasks have issues.
Possible reason(s):
Specified virtual channel or task is invalid.
If you are attempting to add channels to a task, create a virtual channel using the DAQ Assistant or DAQmx Create Virtual Channel, and then add the virtual channel to the task.
If you are attempting to reference a LabVIEW NXG project task from a LabVIEW NXG VI, any of the following may resolve the error:
1. Ensure the task name is correct.
2. Use a DAQmx Task constant to reference the task from the VI's diagram.
3. Configure the task's owning Application or Library to export or always include the task.
08-02-2023 03:08 PM
Hi Sam,
@801Sam wrote:
Does doing this combine the two channels? I need to figure out how to do this through programming. I tried creating the two channels then flattening them.
When you want to add two channels to a DAQmx task you can call CreateVirtualChannel twice one after the other and wire the DAQmx task from first to second…
08-02-2023 03:17 PM
Ok, I got it. The problem I was having was I forgot to change channel name for the second create. Thank you for your help