09-14-2010 10:39 AM
I don't understand the second parameter (data(,) as UShort) of the AnalogUnscaledWriter.Write() method. In the documentation it states; "Each element in the first dimension of the array corresponds to a channel in the task". But what does that mean?
Here's some code in which I intent to use it, where Value is the UShort value I intend to send to the DAC;
myTask = New Task()myTask.AOChannels.CreateVoltageChannel(Address, "", Convert.ToDouble(-5), Convert.ToDouble(5), AOVoltageUnits.Volts)New AnalogUnscaledWriter(myTask.Stream)True, SendValue)
Dim SendValue(0, 0) As UShort
SendValue(0, 0) = 0
SendValue(0, 1) = Value
Dim
USWriter As AnalogUnscaledWriter
USWriter =
USWriter.Write(
09-14-2010 10:54 AM
Sorry, that last statement got chopped up somehow. It should read;
USWriter.Write(
True, SendValue)
09-16-2010 01:56 PM
Hi Tim,
In your tasks, you can have multiple channels, so when you provide data to write to the card, you need to provide which data should be used for each channel. For example, let's assume you have 3 channels and want to write 6 points of data to each channel. In this case, you would have a 2D array. Think of the 2D as an arary of arrays. So, each of the 3 elements in the first dimension is an array. Each of these 3 arrays holds the 6 data points that should be written to a particular channel in the task. Hope this helps!
Best,
John M
09-16-2010 02:38 PM
John,
I understand how the data is organized in the AnalogUnscaledWriter.Write, but not so much the channel information. The documentation says that each element in the first dimension of the array corresponds to a channel in the task. But how? I have one channel in my task and I guessed that using a zero in the first dimension would access that channel, and apparently it did. But the documentation wasn't that clear. What would happen if I have more than one channel? Would they just be 0, 1, etc.? And which channel would be assigned which number?
Tim