SMC_CheckForLimits (FB)

 

FUNCTION_BLOCK SMC_CheckForLimits

The function block checks whether a path leaves its specific, rectangular range.

Example

Assignment of input poqDataIn

Typically, poqDataOut of the previous function block is fed to the input poqDataIn. That can be an instance of the function block SMC_NCDe­coder or SMC_SmoothPath.

Allocating memory for the preprocessing of the path elements

If the function block is executed, memory is needed, in which the processing elements are copied. The buffer must be able to hold at least five SMC_GEOINFO objects. If the structure is too small, the function block performs no actions. The memory is declared in the IEC program as an array of objects of type SMC_GEOINFO.

PROGRAM Path
VAR
   buf2: ARRAY[1..50] OF SMC_GeoInfo;
END_VAR

Determining the size of the allocated memory area

The size of the memory is determined by the operator SIZEOF in the implementation of the IEC program and is fed to the input nSizeOut­Queue. The address of the memory is defined with the operator ADR and is fed to the input pbyBufferOutQueue.

SMC_CheckForLimits.png

InOut:

Scope

Name

Type

Initial

Comment

Input

bExecute

BOOL

FALSE

Execution starts on the rising edge.

bAbort

BOOL

FALSE

TRUE: Aborts the processing of the function block

poqDataIn

POINTER TO SMC_OUTQUEUE

NULL

Pointer to data of structure SMC_OUTQUEUE containing the path objects of type SMC_GEOINFO.

wAddAxis

WORD

Bit field of the axes that will be tested

  • X: Bit 0

  • Y: Bit 1

  • Z: Bit 2

  • A: Bit 3

  • B: Bit 4

  • C: Bit 5

  • P: Bit 6

  • Q: Bit 7

  • U: Bit 8

  • V: Bit 9

  • W: Bit 10

Example: 16#104 causes test of Z and U

piMin

SMC_POSINFO

Lower edge of permissible range

piMax

SMC_POSINFO

Upper edge of permissible range

d3dCheckDistance

LREAL

In case of an 3D-object, the distance between the points that are checked. If 0, the number of points per object will be the object's length divided by 10, plus start- and end-position.

diMinNoPoints

DINT

5

Apart from start- and end-position, the minimal number of points per object that are checked.

diMaxNoPoints

DINT

100

Analogously. -1 means that there is no maximum number.

Output

bBusy

BOOL

FALSE

TRUE: Function block in execution

bError

BOOL

FALSE

TRUE: Error has occurred

wErrorID

SMC_ERROR

SMC_NO_ERROR

Error identification

wAxisOutOfLimits

WORD

Axes that have left the boundary

iSourceLine_No

DINT

-1

Line number of the object that has exceed the limit

poqDataOut

POINTER TO SMC_OUTQUEUE

NULL

Pointer to data of structure SMC_OUTQUEUE containing the path elements of type SMC_GEOINFO that has been checked

wLimitSwPositive

WORD

Axes that have exceeded the upper limit

wLimitSwNegative

WORD

Axes that have exceeded the lower limit