Table of Contents

IDigital

Namespace
ZEquipment
Extends
Inherited Methods
INTERFACE IDigital EXTENDS ZCore.ITrigger

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.

Properties

Enabled

PROPERTY Enabled : BOOL

Property Value

BOOL

Simulation

PROPERTY Simulation : BOOL

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 Value

BOOL

Methods

Enable

METHOD Enable (
 [input] on : BOOL)

Inputs

on BOOL

FallingTrigger

METHOD FallingTrigger () : BOOL

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

Returns

BOOL

Invert

METHOD 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);

Name

METHOD Name () : ZCore.ZString

This method returns the name that has been set with SetName

Returns

ZString

RisingTrigger

METHOD RisingTrigger () : BOOL

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

Returns

BOOL

SetLogger

METHOD SetLogger (
 [input] logger : ZCore.ILogger)

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).

Inputs

logger ILogger

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

SetLogic

METHOD SetLogic (
 [input] logic : DigitalLogic)

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, ...).

Inputs

logic DigitalLogic

SetName

METHOD SetName (
 [input] name : ZCore.ZString)

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.

Inputs

name ZString

SetTriggerLogic

METHOD SetTriggerLogic (
 [input] logic : DigitalLogic)

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

Inputs

logic DigitalLogic

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