MC_SetPos

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Changes the present actual positionClosed Position means a point in space which is described by different coordinates. Depending on the used system and transformation it can consist of a maximum of six dimensions (coordinates).This means three Cartesian coordinates in space and coordinates for the orientation. In ACS there can be even more than six coordinates. If the same position is described in different coordinate systems the values of the coordinates are different. of the axis (as reported by MC_ReadActPos) to the position specified by the Position and Mode inputs.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edgeClosed The transition of a digital signal from low to high. AKA: positive edge., request to queue the change to the axis position.

Axis

AXIS_REF

1, 256

N/A

No default

Name of a declared instance of the AXIS_REF library functionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances..

Position

LREAL

No range

N/A

No default

Absolute Mode: New Axis Position to replace the present position.

Relative Mode: Position offset to apply to present position.

Typically used with multi-turn absolute position feedback devicesClosed A process where some proportion of the output signal of a system is passed (fed back) to the input. In automation, a device coupled to each motor to provide indication of the motor's shaft angle, for use in commutating the motor and controlling its speed and position. Some systems use a feedback device connected to the motor shaft or part of the driven mechanism to control the direction, acceleration and speed of the motor..

Mode

BOOL

FALSE, TRUE

N/A

No default

LOW = Position input is an absolute position.

HIGH = Position input is a relative position

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

Indicates the reference move and position adjustment is complete.

Busy

BOOL

FALSE, TRUE

N/A

Indicates this function block is executing.

Error

BOOL

FALSE, TRUE

N/A

Indicates either:

  • An invalid input was specified.
  • The move was terminated due to an error.

ErrorID

INT

-32768 to +32767

 

Indicates the error if Error output is high.

See PLCopen Function Block ErrorIDs.

Remarks

Figure 1: MC_SetPos

FBD Language Example

Not available.

FFLD Language Example


  • This function block finishes immediately.
    Because of this, the Done output does not get set to FALSE in a second call to the same MC_SetPos instance unless there is an error.

    If the application needs to look for a state change to determine if a particular call to MC_SetPos was successful, then use AND for the rising edge of the Execute input, the Done output, and the inverse of the Error output.

    This FFLD Language example shows how this can be done.
    In the example, the SetPosSuccessful variable is set to TRUE for one cycle upon a successful call to the MC_SetPos instance.

IL Language Example

Not available.

ST Language Example

            (* MC_SetPos STClosed Structured text - A high-level language that is block structured and syntactically resembles Pascal. example *)
            
Inst_MC_SetPos ( Axis1 , 0, 0 );
//Inst_MC_SetPos is an instance of MC_SetPos function (* MC_SetPos absolute mode example: Set position value to zero. *)
Inst_MC_SetPos ( Axis1 , 0, 0 );
//Inst_MC_SetPos is an instance of MC_SetPos function
(* MC_SetPos relative mode example: Increase position value by 1000. *)
Inst_MC_SetPos ( Axis1 , 1000, 1 );
//Inst_MC_SetPos is an instance of MC_SetPos function