Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use the AnalogUnscaledWriter.Write method?

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(

0 Kudos
Message 1 of 4
(3,475 Views)

Sorry, that last statement got chopped up somehow. It should read;

 

USWriter.Write(

 

 

True, SendValue)

0 Kudos
Message 2 of 4
(3,473 Views)

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

National Instruments
Applications Engineer
0 Kudos
Message 3 of 4
(3,427 Views)

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

0 Kudos
Message 4 of 4
(3,425 Views)