Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E123: Division by zero error

This error occurs when a literal or constant on the right side of a division operation is zero.

Examples

Literal is zero

FUNCTION main
    VAR
        x : DINT;
        divX : DINT;
    END_VAR

    x := 5;
    divX := x / 0;
END_FUNCTION

Constant is zero

VAR_GLOBAL CONSTANT
    ConstantZero: DINT := 0;
END_VAR

FUNCTION main
    VAR
        x : DINT;
        divX : DINT;
    END_VAR

    x := 5;
    divX := x / ConstantZero;
END_FUNCTION