Jump to content
  • 0

How to setup edge trigger for USB-1608FS board


Walid
 Share

Question

Hi,

I have been struggling with this for quite a while and really need to get to a resolution. Using a USB-1608FS board, I am simply trying to reproduce programmatically what I've been able to do easily withTracerDAQ: initiate an ADC scan with AInScan() based on a rising edge trigger (from either the analog channel from the signal itself or the external digital trigger). As per the documentation, there are 2 trigger setup commands, ATrig() and SetTrigger() that somehow together should be able to accomplish this. 

From the manual:

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.

SetTrigger()
Selects the trigger source and sets up its parameters. This trigger is used to initiate analog to digital
conversions using the following Universal Library for .NET methods:
AInScan(), if the ExTrigger option is selected.

I've used the following in VB.Net and indeed it only triggers when the trigger is above 0, but not on the rising edge, so the signal is randomly moving around (I check the status in a timer in the standard way after AInScan). Note that there are no options for TrigPosEdge with ATrig, only TrigAbove or TrigBelow:

Dim dataval As Short
Dim threshold As Short = 32767
ULStat = DaqBoard.ATrig(0, MccDaq.TriggerType.TrigAbove, threshold, Range, dataval)

ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, Rate, Range, MemHandle, Options)

All attempts to use SetTrigger(), such as

ULStat = DaqBoard.SetTrigger(MccDaq.TriggerType.TrigPosEdge, threshold, threshold)

were also not having any impact on the trigger, and I've tried multiple combinations to no avail. If anyone could provide a simple example on how to do this most basic analog input, I would very much appreciate it (there are no examples in the example files provided).

 

Thanks,

Walid

Link to comment
Share on other sites

3 answers 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.

image.png

 

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.

Regards,

Fausto

Link to comment
Share on other sites

  • 0

Thanks Fausto. I finally figured out how to trigger using an external digital trigger option and SetTrigger. I needed to set the option ExtTrigger for AInScan via the following command:

 

            Options = MccDaq.ScanOptions.Background Or MccDaq.ScanOptions.ExtTrigger

and then initiate the scan via AInScan:

  ULStat = DaqBoard.AInScan(LowChan, HighChan, Count, Rate, Range, MemHandle, Options)

And as you state, it correctly triggers on the edge of the connected external trigger.

However, I'm still curious how TracerDAQ can trigger on an analog channel independent of the external trigger being connected (it definitely works!). Is there an undocumented method that TracerDAQ uses to allow for triggering on an analog channel?

Link to comment
Share on other sites

  • 0

The USB-1608FS does not have an analog trigger, just digital trigger. TracerDAQ uses an algorithm where it sorts through the data looking for the first instance where the trigger value meets the analog input data value, and starts to display the data from that point forward.

To be clear, there is no undocumented method, just a sort through the acquired data to find the first match.

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
 Share

×
×
  • Create New...