Raidoh
2007-12-17 22:10:17 UTC
I'm trying to configure my NI-USB-6211 to watch for a digital input as an interrupt request instead of an on-demand sample. I'm using Visual Basic 6.0. I've identified the DAQmxSetDIDataXferMech function and the DAQmx_Val_Interrupts value, but the help files I have refer to C code instead of VB code.From Help:int32 __CFUNC DAQmxSetDIDataXferMech(TaskHandle taskHandle, const char
channel[], int32 data);So far, I get an "= expected" error when I try to use it in my code:Private Sub SetupTriggerDAQ() Dim sampsPerChanRead As Long Dim data As Long Dim numBytesPerSamp As Long Dim bufferSize As Long Dim channelList As String * 255 Dim arraySizeInBytes As Long Dim readArray() As Byte On Error GoTo ErrorHandler arraySizeInBytes = 1 'Can be changed to read more digital channels bufferSize = 255 ' Re-initialize a dynamic array to hold values read off the digital lines ReDim readArray(arraySizeInBytes) 'Load the DAQmx task that was created in NI-DAQ MAX DAQmxErrChk DAQmxLoadTask("TriggerDigIn", TriggerHandle) 'Start the task running and read from digital lines DAQmxErrChk DAQmxStartTask(TriggerHandle) DAQmxErrChk DAQmxReadDigitalLines(TriggerHandle, 1, 10#, _ DAQmx_Val_GroupByChannel, readArray(0), arraySizeInBytes, _ sampsPerChanRead, numBytesPerSamp, ByVal 0&) DAQmxSetDIDataXferMech(TriggerHandle, "DigitalIn", DAQmx_Val_Interrupts) If readArray(0) <> 0 Then bTrigger = True End If DAQmxClearTask (TriggerHandle) Exit Sub ErrorHandler: MsgBox Err.Number & " " & Err.Description, , "Error"End SubAttached is the MAX task that is loaded, should that be of any use. Your help is appreciated. Thanks,Chad
channel[], int32 data);So far, I get an "= expected" error when I try to use it in my code:Private Sub SetupTriggerDAQ() Dim sampsPerChanRead As Long Dim data As Long Dim numBytesPerSamp As Long Dim bufferSize As Long Dim channelList As String * 255 Dim arraySizeInBytes As Long Dim readArray() As Byte On Error GoTo ErrorHandler arraySizeInBytes = 1 'Can be changed to read more digital channels bufferSize = 255 ' Re-initialize a dynamic array to hold values read off the digital lines ReDim readArray(arraySizeInBytes) 'Load the DAQmx task that was created in NI-DAQ MAX DAQmxErrChk DAQmxLoadTask("TriggerDigIn", TriggerHandle) 'Start the task running and read from digital lines DAQmxErrChk DAQmxStartTask(TriggerHandle) DAQmxErrChk DAQmxReadDigitalLines(TriggerHandle, 1, 10#, _ DAQmx_Val_GroupByChannel, readArray(0), arraySizeInBytes, _ sampsPerChanRead, numBytesPerSamp, ByVal 0&) DAQmxSetDIDataXferMech(TriggerHandle, "DigitalIn", DAQmx_Val_Interrupts) If readArray(0) <> 0 Then bTrigger = True End If DAQmxClearTask (TriggerHandle) Exit Sub ErrorHandler: MsgBox Err.Number & " " & Err.Description, , "Error"End SubAttached is the MAX task that is loaded, should that be of any use. Your help is appreciated. Thanks,Chad