Skip to content

Sensors

Interfaces

I_DigitalSensorBase

Properties

Property Type Access Description
Active BOOL RO Get the current state of the sensor
DebounceMode E_DebounceMode RW Get/Set the filter to be applied to sensor input
DebounceTime TIME RW Get/Set filter time to be used by DebounceMode
Inverted BOOL RW Get/Set if output of sensor should be inverted with respect to its input
SimulationInput BOOL RW Get/Set signal to use when component is in simulation mode
SimulationMode E_SensorSimulationMode RW Get/Set type of simulation to be used in simulation mode
TimeActive TIME RO Get time elapsed since last inactive state
TimeInactive TIME RO Get time elapsed since last active state

Function Blocks

FB_DigitalSensor

1
FUNCTION_BLOCK FB_DigitalSensor EXTENDS FB_ComponentBase IMPLEMENTS I_DigitalSensorBase
Basic digital input processor for digital signals. Includes locally-defined HardwareInput AT %I* : BOOL for linking to hardware.

DUTs

E_DebounceMode

1
2
3
4
5
6
7
TYPE E_DebounceMode : (
        RawInput,
        SimpleFlickerFilter,
        EdgeDetectFilter,
        MovingAverage
    ) DINT;
END_TYPE

E_SensorSimulationMode

1
2
3
4
5
TYPE E_SensorSimulationMode : (
        InputDriven, //Follows the state of the SimulationInput property
        Periodic     //Follows a 50% duty cycle at the period specified in ms by SimulationInput);
    );
END_TYPE

ST_DigitalSensor_HMI

1
2
3
4
5
6
7
TYPE ST_DigitalSensor_HMI :
    STRUCT
        Config  : ST_DigitalSensor_Config;
        Command : ST_DigitalSensor_Command;
        Status  : ST_DigitalSensor_Status;
    END_STRUCT
END_TYPE

ST_DigitalSensor_Command

1
2
3
4
TYPE ST_DigitalSensor_Command :
    STRUCT
    END_STRUCT
END_TYPE

ST_DigitalSensor_Config

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
TYPE ST_DigitalSensor_Config :
    STRUCT
        //Status information
        DebounceMode       : E_DebounceMode;
        DebounceTime       : TIME;
        Inverted           : BOOL;
        SimulationMode     : E_SensorSimulationMode;
        SimulationTimebase : UINT;
    END_STRUCT
END_TYPE

ST_DigitalSensor_Status

1
2
3
4
5
6
7
TYPE ST_DigitalSensor_Status :
    STRUCT
        Active       : BOOL;
        TimeActive   : LREAL;
        TimeInactive : LREAL;
    END_STRUCT
END_TYPE