Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

6229 + Visual Basic 6

Running a USB 6229, programming with VB6, because I am a strict newby with LV

 

Following is a code snippet attached to a Command Button:

 

cmdReadCH0_Click() 

 

Dim Value As Double

    'Create task
    DAQmxErrChk DAQmxCreateTask("", Handle1)
    Task1Flag = True
   
    DAQmxErrChk DAQmxCreateAIVoltageChan(Handle1, "Dev1/ai0:1", "", DAQmx_Val_InputTermCfg_Diff, 0, 0.2, DAQmx_Val_VoltageUnits2_Volts, "")
   
    'DAQmxErrChk DAQmxReadAnalogF64(Handle1, 1, 10, DAQmx_Val_GroupByChannel, Value, 1, 1, 1)
    DAQmxErrChk DAQmxReadAnalogF64(Handle1, 1, 10, DAQmx_Val_GroupByScanNumber, Value, 1, 1, " ")
   
    lblCh1.Caption = CStr(Value)
   
    If Task1Flag Then
        DAQmxClearTask Handle1
        Task1Flag = False
    End If

 

End Sub

 

I am setting up channel 0 as differential, with a range of 0 to 200 millivolts, 10 second timeout, simply to read and display (for now).

 

I get RunTime Error '-200492(fffcf0d4)'  Measurements: Reserved Parameter must be NULL.

 

I am obviously not defining the parameters in the function call properly, but which ones?

 

Thanx for the guidance.

 

 

0 Kudos
Message 1 of 4
(7,226 Views)

Hi JEY2,

         This KB discusses the solution to your error.  Please let me know if you're still having problems with this.  Have a great day!

 

0 Kudos
Message 2 of 4
(7,212 Views)

Yes, that KB took care of the problem.  I had to increase the size of the buffer to get a good read, but that was simple.

 

What is the significance of the ":1" in the address "Dev1/ai0:1"?

 

Thanks again for the help.

 

 

 

JEY

0 Kudos
Message 3 of 4
(7,188 Views)
Glad that helped!  The significance of the ":1" is that "Dev1/ai0:1" means channels 0 through 1 (so you're using 2 channels).  If you only wanted to use one channel you could simply specify "Dev1/ai0".  Have a good one!
0 Kudos
Message 4 of 4
(7,178 Views)