Search the Community
Showing results for tags 'triggerslope'.
Hi, 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" tmrCheckStatus.Start() 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 tmrCheckStatus.Stop() 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 Else 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. Thanks, Walid