Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

System throwing null reference exception when creating voltage task

Hello,
I am trying to read analog data on a 6009 DAQ using c#
However, when I try and create a voltage channel, I get a null reference exception. Can anyone point me in the right direction with this?

The exception happens on:
atask.AIChannels.CreateVoltageChannel(SquibCombo.Text,"", AITerminalConfiguration.Nrse,0,3.5,NationalInstruments.DAQmx.AIVoltageUnits.Volts);
SquibCombo.Text is "Dev2/ai0" at runtime

Thank you
David
0 Kudos
Message 1 of 3
(3,774 Views)
Hi David,

Please can you look at a C# example located at
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Analog In\Measure Voltage\ContAcqVoltageSamples_IntClk\cs

This will show you how to call the functions, and then allow you to modify the code for your purposes.

Regards
JamesC
NIUK and Ireland

It only takes a second to rate an answer 🙂

0 Kudos
Message 2 of 3
(3,762 Views)
In case anyone has the same problem, I wasn't initialising the task properly. Thanks for the reply
0 Kudos
Message 3 of 3
(3,744 Views)