05-09-2011 01:52 PM
Hey All,
I am using a PCI-6281 in conjunction with an SCB-68 Breakout board. I am trying to gather samples from a Current Channel (4-20mA signal) and at the same time gather samples from a thermocouple. I have been looking on the forums, but am having trouble figuring it out....my main issues are as follows:
1) I have to setup a differential thermocouple channel on AI0 and AI8 (using the proper DIP switch settings on the breakout board). I also have to setup a current input channel on AI3. Is it possible to setup two types of channels on one task?
2) How do I setup multiple channels on a task, even if they were the same type?
3) Can someone give me an example of what the waveform data is goin to look like coming back from these channels?
Thanks for any help!
05-10-2011 06:30 PM - edited 05-10-2011 06:31 PM
Hi EliG,
1) Yes.
2) You can call myTask.AIChannels.CreateXYZChannel() multiple times. You can also specify multiple physical channel names per call, such as "Dev1/ai0:7" or "Dev1/ai0,Dev1/ai3".
3) Here's how the help explains the return value of AnalogMultiChannelReader.ReadMultiSample():
"A 2D array of floating-point samples from the task. Each element in the first dimension of the array corresponds to a channel in the task. Each element in the second dimension of the array corresponds to a sample from each of the channels. The order of the channels in the array corresponds to the order in which you add the channels to the task or to the order of the channels you specify in ChannelsToRead."
If you configure the task the way you described, then X[0,0] is the 1st TC sample, X[1,0] is the 1st current sample, X[0,42] is the 43rd TC sample, X[1,99] is the 100th current sample, etc.
Brad
05-11-2011 06:57 AM
Hi EliG,
Thank you for your forum post. I have answered your questions in the list below.
1. In general, it is possible to set up multiple channels on the same task, however, they would all have to be the same input configuration such as differential or referenced single ended. For better accuracy on a current measurement, it would be preferable to take a differential measurement since you will be measuring a relatively small voltage across a current sense resistor. I would propose, setting up two differential AI channels in the same task.
2. In the CreateVoltageChannel function, the physicalChannelName string parameter would have something like:"Dev1/ai0:1". This would specify you will want to set your task to include analog channels 0-1. If doing a differential measurement, you do not have to include the upper corresponding channels such as ai8 and ai9. To get a better feel for the coding you should look at the examples found in the NI-DAQ folder. From your Windows Start menu you can find them by going to All Programs --> National Instruments --> NI-DAQ --> Text-Based Code Support --> .NET 4.0 Examples. This will open a folder location of examples and I would recommend looking at the example found in \Analog In\Measure Voltage\AcqMultVoltageSamples_SWTimed\CS. I've modified the physicalChannelName function call to read ai0 and ai1 and for it also to be differential measurements. The final call looked like this:
myTask.AIChannels.CreateVoltageChannel("Dev1/ai0:1", "",
(AITerminalConfiguration)(10106),Convert.ToDouble(minimumValueNumeric.Value),
Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);
3. In the example, the waveform data will be a 1-D array of size of how many channels read. You should be able to change the function call to do multiple reads per channel and have it return a larger array of all the datapoints of multiple reads in multiple channels (2-D array).
Thanks!
Brandon G
05-11-2011 11:23 AM
Hi EliG,
I need to make a correction to a statement 1 I posted earlier. You can in fact do different types of input configurations on most newer DAQ devices such as your 6281. To do this you would simply have two function calls to CreateVoltageChannel; one function call would specify the differential inputs and their respective ai channels, and the second would be RSE with their respective ai channels. Remember, with differential inputs, you specify just the lower ai channel in the differential pair. If you have the extra ai pins, however, you will have better accuracy if doing differential measurements.
Thanks EliG,
Brandon G