WaitDigTrig (Use an External Digital Trigger)

The WaitDigTrig instruction is used to trigger a measurement scan with an external digital trigger.

Syntax

WaitDigTrig ( ControlPort, Option )

Remarks

The WaitDigTrig instruction is used to trigger measurement scans from an external digital input to a datalogger terminal. When the digital channel is in the state specified by the Option parameter, the scan takes place. For subsequent scans to occur, the digital channel’s state must evaluate as false and then true again (i.e., if the trigger condition remains true, only one scan will occur). A common use of this instruction is to control the scan rate of one datalogger based on another datalogger or control the scan rate of a datalogger based on an external device such as a GPS.

The WaitDigTrig instruction can be executed within a Scan/NextScan sequence or it can be executed outside a scan (most commonly in a SlowSequence). When used inside a scan, execution of the scan occurs when WaitDigTrig evaluates as true (for example, port rises/falls or goes high/low) rather than basing the scan rate on the datalogger's clock. Thus, an external trigger controls the scan rate. This has ramifications:

When used outside a scan, WaitDigTrig behaves similarly to a Delay instruction, though the delay is based on the state or transition of a control port instead of based on time. In this instance, the WaitDigTrig instruction can be placed inside an infinite Do/Loop, and the remaining instructions in that loop will be performed only when WaitDigTrig is true. This results in functionality similar to the Interrupt Subroutine available in Edlog-programmed dataloggers (such as the CR10X or CR23X's subroutine 96, 97, or 98).

NOTE: If the program is running in sequential mode and has a slow sequence that includes a WaitDigTrig instruction, once triggered, that sequence will not be able to perform any measurement tasks when the main scan is running. The slow sequence will pause before its first measurement instruction, until the main scan is completed, after which it will continue. If the slow sequence contains only processing tasks, these tasks can run in conjunction with the main scan.

Parameters

ControlPort (Control Port)

The ControlPort parameter is used to specify the digital channel that will be used to trigger the scan. Right-click to display a list.

Code Description
C1 Control terminal 1
C2 Control terminal 2
C3 Control terminal 3
C4 Control terminal 4
U1 Universal terminal 1
U2 Universal terminal 2
U3 Universal terminal 3
U4 Universal terminal 4
U5 Universal terminal 5
U6 Universal terminal 6
U7 Universal terminal 7
U8 Universal terminal 8
U9 Universal terminal 9
U10 Universal terminal 10
U11 Universal terminal 11
U12

Universal terminal 12

Type: Constant

Option (Signal Type)

Used to specify what type of signal will cause the scan to begin. Right-click to display a list of options:

Code Description
0 ControlPort going from low to high (edge triggered)
1 ControlPort going from high to low (edge triggered)
2 ControlPort is high (level triggered)
3 ControlPort is low (level triggered)

Type: Constant

Caution: The port for WaitDigTrig is configured at compile time. Once a port has been configured using WaitDigTrig, you cannot use a different option for that port using a different WaitDigTrig instruction later in the program.