Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxCreateAICurrentChan

Hello All:
I'm trying to read a current channel and voltage channel on Analog channels of the 6023E card using VB.
 
'Code to read the current channel.
DAQmxErrChk DAQmxCreateAICurrentChan(taskHandleCH0, "Dev1/ai0", "", _
                    DAQmx_Val_InputTermCfg_RSE, dblCH0_Min, dblCH0_Max / dblCH0_Multiplier, DAQmx_Val_CurrentUnits1_Amps, _
                    DAQmx_Val_CurrentShuntResistorLocation1_External, 0.1, "")
'Read in one sample from the analog input channel.
DAQmxErrChk DAQmxReadAnalogScalarF64(taskHandleCH0, 10#, data, ByVal 0&)
'Display the acquired sample on the user interface
txtCH(0).Text = CStr(Math.Round(data * dblCH0_Multiplier + dblCH0_Offset, dblCH0_Precision))

 
'Code to read the Voltage channel.
DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandleCH3, "Dev1/ai3", "", _
                    DAQmx_Val_InputTermCfg_RSE, dblCH3_Min, dblCH3_Max / dblCH3_Multiplier, DAQmx_Val_VoltageUnits1_Volts, "")
'Read in one sample from the analog input channel.
DAQmxErrChk DAQmxReadAnalogScalarF64(taskHandleCH3, 10#, data, ByVal 0&)
'Display the acquired sample on the user interface
txtCH(1).Text = CStr(Math.Round(data * dblCH3_Multiplier + dblCH3_Offset, dblCH3_Precision))
 
 
I can read the voltage channel correctly but, I get a constant current value back which is not right.
I am trying to read the current in microAmps range. Please let me know what is wrong with the code.
 
Thanks.
 

 
 
 
0 Kudos
Message 1 of 4
(7,647 Views)
IdleBrain,

Thanks for contacting National Instruments.  There are some examples that come with DAQmx that you can look at for vb located at C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\DAQmx\Analog In\Measure Current\ContAcq0_20mACurrentSamples_IntClk\Vb

I looked through your code and it looks right.  a 0.1 ohm resistor seems small, but if that is what you have then that should be right.  What kind of voltage levels are being applied to this input?  Maybe it is too small due to noise.  What is the constant value you are getting?  Also I would try a differential configuration to see if that improves your measurement.  Secondly take the voltage measurement out of the program and test just the current.  But these are just troubleshooting tips you could come up with on your own. 

Lastly, if the signal is too small you may not be able to read it.  The absolute accuracy on the 6023E is 0.106mV at the 0.05 to -0.05V voltage range setting.  The absolute accuracy is even higher at the higher voltage levels.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 4
(7,619 Views)

Hello Kenn,

Thanks for the reply.

I shall try your suggestions and let you know how they'll work.

I was also thinking of measuring just the voltage and dividing by external resistor value to obtain the current.

Please check back this thread after a couple of days.

ThanX.

 

0 Kudos
Message 3 of 4
(7,606 Views)
IdelBrain,

Doing a voltage reading and dividing by the resistance is pretty much all the current task does, that's why it asks for the resistor value so doing that should be just fine.  Let me know how it turns out.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 4 of 4
(7,602 Views)