Table of Contents

IDigital

Namespace
ZEquipment

This is the interface for any digital input and digital output that are used in the Zeugwerk Framework. The interface offers methods to detect falling and rising edges of digital interfaces. It also extends from the trigger interface, to make the method HasTriggered available. This method returns the result of either RisingTrigger or FallingTrigger, depending on the trigger logic of the object.

INTERFACE IDigital EXTENDS ZCore.ITrigger
Extends
Inherited Methods

Properties

Enabled

PROPERTY Enabled : BOOL

Property Value

BOOL

Simulation

By default all digital interfaces that extend from this function block are simulated, to disable simulation mode this can be done by changing this property. Usually, the decision if simulation is used, takes places during initialization phase. However, some applications require to switch between these modes on-the-fly. In the latter case simply call this method at any time.

PROPERTY Simulation : BOOL

Property Value

BOOL

Methods

Enable

Depending on the logic configuration, this method is used to manipulate the state of the digital interface.

METHOD Enable (
 on : BOOL)

Inputs

on BOOL

FallingTrigger

Consecutive calls to this method returns TRUE once, whenever the state of the digital interface switched from IsEnabled to NOT IsEnabled. It is the same as using a FallingTrigger instance or using an F_TRIG instance on Enabled.

IF digitalInput.FallingTrigger()
THEN
// ...
END_IF
METHOD FallingTrigger () : BOOL

Returns

BOOL

Invert

This method inverts the state of the digital interface.

Initial state Invert
TRUE FALSE
FALSE TRUE

It is the same as calling

digitalIO.Enable(NOT digitalIO.IsEnabled);
METHOD Invert ()

Name

This method returns the name that has been set with SetName

METHOD Name () : ZCore.ZString

Returns

ZString

RisingTrigger

Consecutive calls to this method returns TRUE once, whenever the state of the digital interface switched from IsEnabled to NOT IsEnabled. It is the same as using a RisingTrigger instance or using an F_TRIG instance on Enabled.

IF digitalInput.RisingTrigger()
THEN
// ...
END_IF
METHOD RisingTrigger () : BOOL

Returns

BOOL

SetLogger

Use this method together with SetName to enable logging for this digital interface. Various methods of this implementation write log messages into the passed logger interface.

Note

Sometimes it is beneficial to disable logging by passing 0 to this method (e.g. for inputs or outputs which are switch very often).

METHOD SetLogger (
 logger : ZCore.ILogger)

Inputs

logger ILogger

Object which implements the ILogger interface, usually one of the Zeugwerk Logger instances of ZAux library

SetLogic

According to the process or the used hardware some signals on the fieldbus are high or low active, but in the PLC it is benefical to have these states inverted. This method allows to switch the logic that the class implementing this interface is operating with. Note that almost all methods of the digital make use of the logic that can be set here. (i.e. RisingTrigger, FallingTrigger, Enable, ...).

METHOD SetLogic (
 logic : DigitalLogic)

Inputs

logic DigitalLogic

SetName

Sets the name of this object as it will show up in any log messages that is created by this object. The name set with this method should be relatable to the name of the input in the electrical plan of your automation project to identify the corresponding input properly. However, please note that logging should not be used for inputs because some of them are switched very often, which leads to a high logging load.

METHOD SetName (
 name : ZCore.ZString)

Inputs

name ZString

SetTriggerLogic

This method controls the logic of the HasTriggered method. By default, the trigger logic is set to Normal.

METHOD SetTriggerLogic (
 logic : DigitalLogic)

Inputs

logic DigitalLogic

logic of the input or output, available types are normal and inverted