Supported platforms: CODESYS 2.3, CODESYS 3.5

AI_V_to_DI (FB)

Description

This function block converts the voltage value to a boolean DI signal with given parameters. When the inputs voltage level exceeds the threshold limit, the function returns the  value as true.

The function returns false, when the voltage falls below the limit calculated by subtracting hysteresis from the threshold.

 

The threshold is given to the function as a voltage with two decimals, e.g. 350 is 3,50V. Hysteresis is given to the function as a percentage of the threshold.

Inputs

Input variable name

Data type

Range

Description

i_Voltage

WORD

0..65535

Voltage value, e.g. 500 = 5,00V

i_Threshold

WORD

0..65535

Threshold voltage, e.g. 100 = 1,00V

i_Hysteresis

BYTE

0..100%

Hysteresis percent of threshold

Outputs

Output variable name

Data type

Range

Description

o_DI

BOOL

FALSE..TRUE

Comparator output

Example code

See also

-

 

Source file Topic000233.htm

Last updated 4-Sep-2025