I'm new here and need some help please. I am using Excel VBA and NI USB-6008 to read in some analog voltages. I have been through the VB6 examples and have come across the example using Excel for digital IO. Can't seem to get my code to work and I'm sure it's to my lack of understanding the syntax.
I tried DAQmxReadAnalogScalarF64 and DAQmxReadAnalogF64, with adjusting things in the config_port_click() sub.
Not sure if it is configuration or in the read subs. Thank you in advance for any help.
Dim taskHandle0 As Long
Dim Status0 As Double
Dim data(0) As Double
Sub Configure_Port_Click()
Status0 = DAQmxCreateTask("", taskHandle0)
Status0 = DAQmxCreateAIVoltageChan(taskHandle0, "Dev1/ai0:7", "", _
DAQmx_Val_InputTermCfg_RSE, 0, 10, _
DAQmx_Val_VoltageUnits2_Volts, "")
Status0 = DAQmxCfgSampClkTiming(taskHandle0, "OnboardClock", 50, DAQmx_Val_Rising, _
DAQmx_Val_AcquisitionType_ContSamps, 50)
Status0 = DAQmxStartTask(taskHandle0)
End Sub
Private Sub Image1_Click()
Stat0 = DAQmxReadAnalogF64(taskHandle0, 1000, 10#, _
DAQmx_Val_GroupByChannel, data(0), 8, 10, ByVal 0&)
'Status0 = DAQmxReadAnalogScalarF64(taskHandle0, 10#, data(0), ByVal 0&)
Range(Cells(3, 1).Address) = data(0)
End Sub
Sub Stop_Task_Click()
Status0 = DAQmxStopTask(taskHandle0)
Status0 = DAQmxClearTask(taskHandle0)