Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ VB 6

Help!!!
 
Below is my VB 6 code. Just AIs: one strain gage, 3 thermo, the rest just regular AIs.
Error occurs on this
DAQmxErrChk DAQmxReadAnalogF64(taskHandle, numSampsPerChannel, dblDuration + 1 / Val(Me.txtFreq), _
                    DAQmx_Val_GroupByChannel, data(0), arraySizeInSamps, sampsPerChanRead, z)
Said z needs to be NULL, I used NULL then z = NULL, v,v,v couldn't solve the problem.
Any help is very very appreciated.
 
Thank you all
 
***********************************
DAQmxErrChk DAQmxCreateTask("", taskHandle)
       
        DAQmxErrChk DAQmxCreateAIStrainGageChan(taskHandle, "cDAQ1Mod1/ai0", "P5", _
                    -0.0125, 0.0125, DAQmx_Val_StrainUnits1_FromCustomScale, DAQmx_Val_StrainGageBridgeType1_FullBridgeI, _
                    DAQmx_Val_ExcitationSource_External, 10, 1, 0, 350, 1, 1, "P5S")
      
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod2/ai0", "P1", _
                    DAQmx_Val_InputTermCfg_Diff, MinValue, MaxValue, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "P1S")
                           
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod2/ai2", "P3", _
                    DAQmx_Val_InputTermCfg_Diff, -5, 5, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "P3S")
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod3/ai0", "F1", _
                    DAQmx_Val_InputTermCfg_Diff, 0, 1000, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "F1S")
 
        DAQmxErrChk DAQmxCreateAIThrmcplChan(taskHandle, "cDAQ1Mod4/ai0", "T1", _
                    0, 100, DAQmx_Val_DegC, DAQmx_Val_ThermocoupleType1_T_Type_TC, _
                    DAQmx_Val_CJCSource1_BuiltIn, 0#, "")
       
        DAQmxErrChk DAQmxSetAITermCfg(taskHandle, "T1", DAQmx_Val_InputTermCfg_Diff)
        DAQmxErrChk DAQmxCreateAIThrmcplChan(taskHandle, "cDAQ1Mod4/ai1", "T2", _
                    0, 100, DAQmx_Val_DegC, DAQmx_Val_ThermocoupleType1_T_Type_TC, _
                    DAQmx_Val_CJCSource1_BuiltIn, 0#, "")
       
        DAQmxErrChk DAQmxSetAITermCfg(taskHandle, "T2", DAQmx_Val_InputTermCfg_Diff)
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod2/ai1", "P2", _
                    DAQmx_Val_InputTermCfg_Diff, MinValue, MaxValue, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "P2S")
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod2/ai3", "P4", _
                    DAQmx_Val_InputTermCfg_Diff, -5, 5, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "P4S")
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod3/ai1", "T3", _
                    DAQmx_Val_InputTermCfg_Diff, -5, 5, _
                    DAQmx_Val_VoltageUnits2_FromCustomScale, "T3S")
        DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "cDAQ1Mod3/ai2", "LP", _
                    DAQmx_Val_InputTermCfg_Diff, MinValue, MaxValue, _
                    DAQmx_Val_VoltageUnits2_Volts, "")
  
        DAQmxErrChk DAQmxGetTaskNumChans(taskHandle, numChannels)
        numSampsPerChannel = CLng(dblRate * dblDuration)
        arraySizeInSamps = numSampsPerChannel * numChannels
                
        ReDim data(arraySizeInSamps)
                   
        'Finite samples
        DAQmxErrChk DAQmxCfgSampClkTiming(taskHandle, "OnboardClock", dblRate, DAQmx_Val_Rising, _
                    DAQmx_Val_AcquisitionType_FiniteSamps, numSampsPerChannel)
       
        'Finite data acquisition
        z = Null
        DAQmxErrChk DAQmxReadAnalogF64(taskHandle, numSampsPerChannel, dblDuration + 1 / Val(Me.txtFreq), _
                    DAQmx_Val_GroupByChannel, data(0), arraySizeInSamps, sampsPerChanRead, z)
      
        DAQmxStopTask taskHandle
        DAQmxClearTask taskHandle
0 Kudos
Message 1 of 3
(3,062 Views)

Hello,

What error codes are you seeing before and after setting the reserve input to NULL?  The error codes will be helpful insight.  I am also curious why you want to reserve the resource if you are stopping and clearing the task right afterwards.  Clearing the task will release any reserved resources.

Please also provide what the specific inputs are for the DAQmxReadAnalogF64 function.

Samantha
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,014 Views)

I forgot this KnowledgeBase I wanted to link.

KB 3QU9DCRM: Error -200492 "Reserved Parameter Must Be NULL" With Visual Basic 6 and NI-DAQmx

 

Samantha
National Instruments
Applications Engineer
0 Kudos
Message 3 of 3
(3,011 Views)