Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 

Trigger Types and Trigger Conditions

Trigger types specify how data logging is initiated and is specified with the TriggerType property. You can think of the trigger type as the source of the trigger.

Depending on the TriggerType value, there may be associated trigger conditions. Trigger conditions determine the condition under which the specified trigger is issued. For some trigger conditions, you may need to specify a trigger condition value. Trigger conditions are specified with the TriggerCondition property. Trigger condition values are specified with the TriggerConditionValue property.

The supported trigger types and trigger conditions for analog input objects are shown below.

Table 4-6: TriggerType and TriggerCondition Values 
TriggerType
TriggerCondition
Description
Manual

None

The trigger occurs just after the trigger function is issued

{Immediate}

None

The trigger occurs just after the start command is issued

Software

You must specify one or more channels as trigger sources. The trigger is issued when a signal satisfying the specified condition is detected on one of the specified channels.

Rising

The signal must be above the specified value and rising

Falling

The signal must be below the specified value and falling

Leaving

The signal must be leaving the specified range of values

Entering

The signal must be entering the specified range of values

For some hardware, additional trigger types and trigger conditions are available. Refer to Chapter 7, "Property Reference" for these device-specific values.

The default TriggerType value is Immediate. An immediate trigger automatically occurs just after the start command is issued. If TriggerType is Manual, the trigger occurs just after you issue the trigger command. An example using a manual trigger is given in "Acquiring Data with a Sound Card". Software triggers are triggers that are issued by the engine when the associated trigger condition is satisfied. Using software triggers is illustrated in the example below.

Note:
After a trigger is issued, the samples specified by SamplesPerTrigger are acquired before another trigger is issued.

Example: Voice Activation Using a Software Trigger

Suppose you want to collect voice data with a sound card, and the condition for collecting this data is based on how loudly you speak. An application of this kind is called voice activation.

The example code shown below demonstrates how you set up an acquisition with a sound card based on voice activation. The sample rate is set to its maximum value and data is logged only after an acquired sample is greater than or equal to 0.2 volts with a rising (positive) slope. This condition is carried out by means of a software trigger. A portion of the collected data is then extracted from the engine and plotted.

Initialization: Create the analog input object AIVoice for a sound card. The installed adaptors and hardware ID's are found with daqhwinfo.

Configuration: Add one hardware channel to AIVoice, and copy it to the variable chan, define a two second acquisition, and set up a software trigger. The source of the trigger is chan, and the trigger is issued when a rising voltage level has a value of at least 0.2 volts.

Execution: Start AIVoice, wait for AIVoice to stop running, and extract the first 1000 samples from the engine as sample-time pairs. Display the number of samples remaining in the engine.

Termination: Plot all the extracted data and delete AIVoice.

Note that when using software triggers, you must specify the TriggerType value before the TriggerCondition value. The output from this example is shown below.


The first logged sample has a signal level value of at least 0.2 volts, and this value corresponds to time = 0. Note that after the getdata command is issued, there remains 87,200 samples in the engine.



[ Previous | Help Desk | Next ]