Trigger Port Description

A Trigger port is a Digital port that continuously monitors one or more digital ports for changes in their state if its Line is High. Triggering can happen on a change from Low to High (rising edge), from High to Low (falling edge), or on both changes.

The checks are done in each iteration of the doWork loop. If a state change is detected the Trigger port can modify the states of other Digital ports (output ports). The effected state change can either be to set the output Digital ports to High, Low, or toggle them. If you specify inverse output ports the state change is inverted, except for the Toggle specification.

Disabling the TriggerPort causes the monitoring to stop. Startup or enabling a Trigger will cause it to read the current state of the monitoring ports. A port that returns an error will be ignored.

A Trigger port can work together with a Counter port to count the occurrences of a certain trigger event.

Settings

Type

Fixed value Trigger.

InputPorts

Required. A list of IDs of Digital ports that are to be monitored by this Trigger port.

Trigger

Defines the triggering event. One of RisingEdge, FallingEdge, or Both. The default is RisingEdge.

Change

Defines how to change the output ports. One of SetHigh, SetLow, or Toggle. The default is Toggle.

OutputPorts

An optional list of IDs of Digital ports that are modified when a trigger event occurs. If Change is SetHigh these ports will be set to High. If Change is SetLow these ports will be set to Low. If Change is Toggle the line of these ports will be toggled.

InverseOutputPorts

An optional list of IDs of Digital ports that are modified when a trigger event occurs. If Change is SetHigh these ports will be set to Low. If Change is SetLow these ports will be set to High. If Change is Toggle the line of these ports will be toggled.

CounterPort

An optional ID of a Counter port that will be incremented by 1 when the trigger event occurs.

Example

[General]
SlaveName = Counter Port Example

[Connection]
Transport = TCP

[Root]
Digital1 = 1
Digital2 = 2
Trigger1 = 3
Trigger2 = 4
Indicator1 = 5
Indicator2 = 6
Counter = 6
WebServer = 9999

[Digital1]
Type = DigitalPort
Mode = Output

[Digital2]
Type = DigitalPort
Mode = Output

; This trigger toggles Indicator1 when it detects
; that Digital1 changed from Low to High.
[Trigger1]
Type = Trigger
InputPorts = Digital1
OutputPorts = Indicator1
CounterPort = Counter

; This trigger toggles Indicator2 when it detects
; that Digital2 changed from High to Low.
[Trigger2]
Type = Trigger
InputPorts = Digital2
Trigger = FallingEdge
OutputPorts = Indicator2

[Indicator1]
Type = DigitalPort
Mode = Output

[Indicator2]
Type = DigitalPort
Mode = Output

; This counter does not increase automatically.
; It is controlled by Trigger1.
[Counter]
Type = Counter
Period = 0

; This node starts a web server at http://localhost:8080
[WebServer]
Type = Plugin
Driver = ../plugins/WebServerPlugin/WebServerPlugin
Readonly = True