12-17-2007 03:43 PM
Private Sub SetupTriggerDAQ()Attached is the MAX task that is loaded, should that be of any use. Your help is appreciated.
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 Sub
12-18-2007 05:08 PM
Hi Chad,
I believe the error that you are getting is due to a syntax error in your code, does the error have a line number associated with it? From looking at your code it would also be helpful to see the section where “DigitalIn” is declared to rule out any syntax errors there. You are using the correct function for setting up a IRQ transfer, I would begin troubleshooting by confirming proper syntax on and around the line numbers given in the error.
04-04-2008 10:09 AM
Guys,
I have similar problem that I need help with. I need to use interrupt on a given INPUT PIN that notifies my program about its status change. I am using VB6 platform. Would appriciate any clues.
Thanks,
MikeA
04-04-2008 10:25 AM
04-07-2008 09:42 AM