Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

6704 current outputs and CWAOPoint in C#

I'm trying to get a current out of channel 16 of a 6704 PXI board using the CWAOPoint control in Visual Studio .Net C#. When I use channels 0-15 it works, however for channels 16-31 I always get an error like this:
The analog input or analog output voltage or current range is invalid for the specified channel, or you are writing an invalid voltage or current to tho analog output.

The values that I'm writing are between 0.1 and 20.2, so that can not be the problem.

This is the code:
AO1.Reset();
AO1.Device = 3; AO1.ChannelString = "16";
float v = 1.5;
AO1.SingleWrite(v, true);

I tried added this, but it still gave the same error:
AO1.LowerLimit = 0.1;
AO1.UpperLimit = 20.2; AO1.ReferenceSource = CWAORef
erenceSources.cwaoDefaultReferenceSource;
AO1.ChannelType = CWAOChannelTypes.cwaoDefaultChannelType;
0 Kudos
Message 1 of 4
(3,812 Views)
Hi,

I've attached an example program, written in VB, that works just fine. The code should be very similar in C#.

Can you give it a try, please?

Regards.
0 Kudos
Message 2 of 4
(3,812 Views)
I don't have VB on my PC, so I rewrote the same code in C#.
Somehow it worked. I copied the code in my original C# project and it worked as well. I still don't know what was wrong with the original code, but the problem is solved now.
0 Kudos
Message 3 of 4
(3,812 Views)
I think I found what the problem was:
With the lowerlimit and upperlimit not specified, it does not work.
With the lowerlimit and upperlimit as in the datasheet of the 6704 (0.1 mA - 20.2 mA) it does not work.
With the values as in the example you attached (0.0 mA - 20.47 mA) it works...
0 Kudos
Message 4 of 4
(3,812 Views)