Jump to content
  • 0

Problems setting up analog or digital trigger input on OM-USB-1608FS




I am trying to understand how to programmatically setup the triggers on the USB-1608FS board so that I can:

1. Read data on the rising edge with trigger level set to 0, similar to the screen shot in TracerDAQ shown below (and showing the trigger options) which gives a stable sine wave starting at 0 for a sine wave input.

2. Read data on the external trigger input from a digital signal (I'm assuming this should be more stable than 1)

I know this can be done with this board and my signals are good because it works fine with TracerDaq. I'm using VB.net, there are no examples provided that do this (the trigger examples only work for a "signal above" level and therefore do not correctly trigger on the rising edge which is what I'm getting as well no matter what I set the trigger condition to), and the user's manual is a little confusing regarding how to use ATrig and SetTrigger in conjunction with AInScan (it suggests it only works with an external trigger, but I know it can work with a channel trigger). I've tried multiple combinations and only get triggers above 0 instead of rising edge triggers (and thus the sine wave just slides around the start trigger depending on when the signal was found to be above 0 rather than a positive edge). I know that the AInScan is armed and waiting for a trigger above 0 because it doesn't return a scan unless that is the case. Also pretriggering via ATrig apparently is not an option for this board.

The code snippet for setting up triggering that loops is:

           ULStat = DaqBoard.StopBackground(MccDaq.FunctionType.AiFunction) 'stop background scan for each trigger event
           Dim TrigVal As UShort = 32767
           Count = 2000    ' total number of data points to collect
                ' per channel sampling rate ((samples per second) per channel)
                Rate = 10000 / ((HighChan - LowChan) + 1)

                'Set up trigger

                ULStat = DaqBoard.ATrig(0, MccDaq.TriggerType.TrigAbove, TrigVal, Range, DataValue)
                ULStat = DaqBoard.SetTrigger(MccDaq.TriggerType.TrigPosEdge, TrigVal, TrigVal)
                Options = MccDaq.ScanOptions.Background

               'Expect AInScan to now wait for trigger rising edge above 0 but instead get trigger at any value above 0

                ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, Rate, Range, MemHandle, Options)
                If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop

and I read it below with a timer (ADData always gives a shifted sine wave instead of one triggering on the rising edge):

     If Status = MccDaq.MccBoard.Running And UserTerm = 0 Then
            lblShowStat.Text = "Running"

        ElseIf Status = MccDaq.MccBoard.Idle Or UserTerm = 1 Then
            lblShowStat.Text = "Idle"
            ULStat = DaqBoard.GetStatus(Status, CurCount, CurIndex, MccDaq.FunctionType.AiFunction)

            If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop

            lblShowCount.Text = CurCount.ToString("D")
            lblShowIndex.Text = CurIndex.ToString("D")
            If SwitchScan.Value = False Then
            End If
            If MemHandle = 0 Then Stop

            If ADResolution > 16 Then
                ULStat = MccDaq.MccService.WinBufToArray32(MemHandle, ADData32, FirstPoint, NumPoints)
                If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop

                For i = 0 To HighChan
                    lblADData(i).Text = ADData32(i).ToString("D")
                Next i
                ULStat = MccDaq.MccService.WinBufToArray(MemHandle, ADData, FirstPoint, NumPoints)
                If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then Stop

            End If

Any advice would be greatly appreciated--a very simple flowchart with the procedure for setting up the board for proper rising edge channel 0 triggering would suffice, and then how to do it with a digital external trigger signal with this board as well.





Edited by Walid
clarified notes
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @Walid.

The two functions are separate.

With the USB-1608FS module, the supported trigger option for the AinScan() function is an external digital (TTL) trigger.  The two supported trigger types are positive and negative edges.





As stated in the 'UL Help' documentation, "ATrig() waits for a specified analog input channel to go above or below a specified value. ATrig() continuously reads the specified channel and compares its value to trigValue. Depending on whether trigType is set to TrigAbove or TrigBelow, it waits for the first A/D sample that is above or below trigValue. The first sample that meets the trigger criteria is returned to dataValue."  It does not capture the specified value; 0V in your case.  A single value is captured with the ATrig() function.




Edited by Fausto
Added TracerDAQ screen capture.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...