MCV_GrpGetNextPrevAx

This FB is a utility FB which can be used in a PLC application.

It is used by the FB MCV_SingleAxisSelect.

With reference to a specified axis, it is used to determine the previous or next axis from the list of axes contained in the axis group.

The result is output as a numerical value. The numerical value is the index which is used to find the searched-for axis from the list of axes in an axis group.

Block diagram

FB parameters

VAR_IN_OUT

Variable name

Data type

Description

AxesGroup

AXES_GROUP_REF

Axis group reference

VAR_INPUT

Variable name

Data type

Description

Enable

BOOL

Provided TRUE is present at the input, the index of the searched-for axis in the axis group is determined dependent on the inputs “StartAxIdx”, “Previous” and “Next”.

StartAxIdx

INT

Index of the axis in the axis group (channel) at which the search for the previous or next axis is started, if a search is made.

The search is started when the “Enable” input is set to TRUE for the first time.

Previous

BOOL

If the input is TRUE, a search is made for a lower index in this sequence after the next axis in the sequence of axes in the axis group.

Next

BOOL

If the input is TRUE, a search is made for a higher index in this sequence after the next axis in the sequence of axes in the axis group.

VAR_OUTPUT

Variable name

Data type

Description

Valid

BOOL

TRUE when the inputs are evaluated.

NextPrevAxIdx

INT

Index of the searched-for axis in the sequence of axes in the axis group.

Error

BOOL

Indicates TRUE when an error occurs.

ErrorID

WORD

Error identifier

Behaviour of the FB:

On a rising edge, the “Prev“ and “Next“ inputs cause a change in the outputs.