I have five channels - the first three (0,1,2) go into a SCXI 1302 passthrough to a PCI-6052E. The other 2 inputs are attached to load cells and go into a SCXI 1314 and the SCXI 1000 to the PCI-6052E. I need to trigger the load cell on channel 3 to collect data when 0 and 1 go high. Then when channel 0 goes low and input 1 is high. If input 2 is high then the load cell on input 4 needs to collect data. Since I can only have one CWAI to configure the channels, how can I trigger channel 3 and 4 to start and stop independantly of the first three channels.
I can get a constant stream a data with this code:
Private Sub CWAI1_AcquiredData(ScaledData As Variant, BinaryCodes As Variant)
Dim chan1() As Double
Dim chan2() As Double
Dim chan3() As Double
Dim chanSCXI0() As Double
Dim chanSCXI1() As Double
Dim chan() As Double
chan = CWArray1.CopyArray(ScaledData)
chan1 = CWArray1.SubsetArray(chan, Array(Array(0, 1), Array(0, 99)))
chan2 = CWArray1.SubsetArray(chan, Array(Array(1, 1), Array(0, 99)))
chan3 = CWArray1.SubsetArray(chan, Array(Array(2, 1), Array(0, 99)))
chanSCXI0 = CWArray1.SubsetArray(chan, Array(Array(3, 1), Array(0, 99)))
chanSCXI1 = CWArray1.SubsetArray(chan, Array(Array(4, 1), Array(0, 99)))
If ScaledData(0, iScans) > -1 And ScaledData(1, iScans) > -1 Then
lblCollect.ForeColor = vbGreen
lblCollect.Caption = "Data Collection Begins: Shield Pull"
'****How can I find the average value and then wait 1 second and get the peak value?
ElseIf ScaledData(1, iScans) > -1 Then
lblCollect.ForeColor = vbGreen
lblCollect.Caption = "Data Collection Begins: Activation"
'****How can I find the average value and wait 1 second and find the peak value?
LogActivation
ElseIf ScaledData(2, iScans) > -1 Then
lblCollect.ForeColor = vbGreen
lblCollect.Caption = "Data Collection Begins: Breakout/Sustain"
'****Need to find the average value then wait 1 second and log 100th value and 500th value of the array
logBreakout
Else
lblCollect.ForeColor = vbRed
lblCollect.Caption = "Waiting for trigger"
End If
Debug.Print " 0 " & Format(ScaledData(0, iscans), "00.000") _
; " 1 " & Format(ScaledData(1, iscans), "00.0000") _
; " 2 " & Format(ScaledData(2, iscans), "00.0000") _
; " 3 " & Format(ScaledData(3, iscans), "00.0000") _
; " 4 " & Format(ScaledData(4, iscans), "00.0000")
End Sub
Any help is appreciated.