FB_CP22xx_Wheel

FB_CP22xx_Wheel 1:

Implements the CP22xx_1025 specific incremental encoder including the 10-segment LED ring.

Syntax:

FUNCTION_BLOCK FB_CP22xx_Wheel EXTENDS FB_ScaleHmi

FB_CP22xx_Wheel 2: Properties

Name

Type

Access

Initial value

Description

Name

STRING

Get, Set

<SourceName>

Specifies the name of the class instance.

FB_CP22xx_Wheel

Enc

I_CP22xx_WheelEnc

Get

THIS^

Selective access to the encoder functions.

FillMode

BOOL

Get, Set

FALSE

The LEDs fill up from GuidingMid to GuidingValue.

GuidingMax

LREAL

Get, Set

100.0

Maximum value of the GuidingValue.

GuidingMid

LREAL

Get, Set

0.0

Value from which the LEDs fill.

Only active with FillMode.

GuidingMidWindow

LREAL

Get, Set

1.0

Tolerance window in which the LEDs indicate a center position.

Only active with FillMode.

GuidingMin

LREAL

Get, Set

0.0

Minimum value of the GuidingValue.

GuidingValue

LREAL

Get, Set

0.0

Control value for the LED display.

Leds

I_CP22xx_WheelLed

Get

THIS^

Selective access to the LED functions.

LimitOverflow

BOOL

Get, Set

FALSE

Limits the current position to the limit values. The internal overflow is deleted directly.

ModuloFactor

LREAL

Get, Set

24.0

Mask of the modulo position.

By default, the factor is set to one revolution of the encoder.

ModuloPos

LREAL

Get, Set

0.0

Modulo position

Position

LREAL

Get

0.0

Current position of the encoder.

PositionMax

LREAL

Get, Set

0.0

Maximum position of the encoder

Only active with LimitOverflow

PositionMin

LREAL

Get, Set

 

Minimum position of the encoder.

Only active with LimitOverflow.

PositionOffset

LREAL

Get, Set

0.0

Position offset of the encoder .

PositionRaw

UDINT

Get, Set

0.0

Raw position of the encoder.

PositionScale

LREAL

Get, Set

0.25

Scaling factor of the encoder position.

Press

I_InputDigital

Get

<Local>

Digital input from pressing the incremental encoder.

Velocity

LREAL

Get

0.0

Current velocity of the encoder (filtered).

FB_Base

BaseState

E_BaseState

Get

eNotHandled

Initialization state of the class instance.

Error

BOOL

Get

FALSE

Class is in an error state.

ResultMessage

I_AppMessage

Get

-

Access to the class-internal EventLogger.

[PROTECTED] _Name

STRING

Get

<SourceName>

.Name without leading 'fb'.

FB_CP22xx_Wheel 3: Methods

Name

Description

Reset()

Resets the error state of the class.

FB_CP22xx_Wheel

SetPosition(fSetPos)

Sets the encoder position to the transferred position value.

SetZero()

Sets the encoder position to 0.

FB_ScaleHmi

[PROTECTED] XtoY(...)

Scales a value x to a value y, using the minimum and maximum value of both scales.

FB_BaseHmi

Init(ipBase)

Default initialization method to pass the base class.

FB_Base

SetHMI(ipBase)

General assignment method for an FB_BaseHmi extending class.

Notice This method always fails in the FB_Base implementation. Overwriting is therefore absolutely necessary.

[PROTECTED] _QueryNamespace()

Extracts the first part of the instance path as an object namespace.

[PROTECTED] _QueryObjectName()

Extracts the last part of the instance path as the object name.

FB_CP22xx_Wheel 4: Cycle methods

Name

Description

Cyclic()

Cycle method - Call once per PLC cycle (default 10 ms).

FB_CP22xx_Wheel 5: Interfaces

Type

Description

I_Base

Standard interface on FB_Base.

I_CP22xx_Wheel

Sum interface on FB_CP22xx_Wheel.

I_CP22xx_WheelEnc

Encoder functions of the FB_CP22xx_Wheel.

I_CP22xx_WheelLed

LED functions of the FB_CP22xx_Wheel.

I_BaseHmi

Standard interface on FB_BaseHmi.

I_BaseEmpty

For extension without standard interface.

I_BaseDev

Covers all methods and properties of the base class.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT >= v3.1.4024.54 (recommended)
TwinCAT >= v3.1.4024.42 (required)

PC or CX (x64, x86)

Tc3_PlasticBaseApplication (>= v3.12.7.0)