ROTATION_DIFFERENCE (FB)ΒΆ

FUNCTION_BLOCK ROTATION_DIFFERENCE

Computes the difference between two UINT values without rollover

This function block receives two values e.g. from an motion encoder and calculates the difference between the two positions.

If curValue := 65535 and lastValue := 15, a negative rotation is detected and diffValues := -16.

If lastValue := 65535 and curValue := 15, a positive rotation is detected and diffValues := 16.

InOut:

Scope

Name

Type

Comment

Input

curValue

UINT

Current value of rotation

lastValue

UINT

Last value of rotation

Output

diffValues

INT

Difference between the two values without rollover