07-12-2013 07:40 AM
Hi,
I had a very simple function written in CVI that adds multiple global virtual channel
DAQmxErrChk (DAQmxAddGlobalChansToTask(g_TaskHandle, linesName)); //linesName consists 2 global virtual channels seperated by ",". E.g. "Power, Com" where Power = port1/line0 & Com = port1/line2
There is AddGlobalFunction in MEasurement Studio too but it allows adding single channel only:
Task localTask = new Task(); localTask.AddGlobalChannel(linesName); //Get Expetion here = -200486, Specified Channel not in the task. When I give a single channel name..it works DigitalSingleChannelWriter doWriter = new DigitalSingleChannelWriter(localTask.Stream); doWriter.WriteSingleSampleMultiLine(true, states); //atates is the array of type bool which consists of value for each channel
Is it not possible any more to add multiple Global Channels to a task??
We have recently acquired Measurement Studio license and are trying to port/compile/write our old libraries (written in CVI) in it.
- Is there any online help that compares CVI C functions with respective .NET functions of DAQmx?
Thanks in advance!
Ciao
Ricky
Solved! Go to Solution.
07-16-2013 12:50 AM
Have been trying this for last 2 days, have also searched number of NI forum messages but have not got solution.
Anyone with slightest of hint?
07-16-2013 01:23 AM
Have been trying this for last 2 days, have also searched number of NI forum messages but have not got solution.
Anyone with slightest of hint?
Meanwhile I have gathered some more Information:
- Adding multiple Global channels in LabWindows/CVI is possible using DAQmxAddGlobalChansToTask function where channels are , (comma) seperated
- Also adding multiple Global channels in LabView where channels are , (comma) seperated.
May be I am wrong but has NI forgotten to implement the same in MeasurementStudio ? Or am I missing something?
07-19-2013 10:02 AM
Hi,
it seems like you are correct. The definition of the method specifies that it only adds one channel:
public NationalInstruments.DAQmx.Channel AddGlobalChannel(string channelName) Member of NationalInstruments.DAQmx.Task Summary: Adds a preconfigured, global channel to the task. Parameters: channelName: The name of the global channel to add to the task. Returns: The global Channel. Exceptions: NationalInstruments.DAQmx.DaqException: The NI-DAQmx driver returned an error.
This could be explained by the fact the function returnes the appropriate instance of the channel object related to the global virtual channel you created.
I tried to check the code reading 2 Global Virtual Channel using the DAQ Assistant in Measurment Studio but I was not able to get much of it (the generated code makes two consecutive calls of the "CreateVoltageChannel" method.
What happen if you call AddGlobalChannel twice?
Task localTask = new Task(); localTask.AddGlobalChannel("Power"); localTask.AddGlobalChannel("Com");
I did not have time to try this so far, but from my understanding of the help file, I assume it could work.
Best regards
07-22-2013 02:28 AM
It worked!
Sorry, I did not even think about calling the function with different channels multiple times.
Thanks for your help!!