Function BlockMC_SetPosPLCopen motion icon

Description

This function block changes the present actual position of the axis (as reported by MC_ReadActPos) to the position specified by the Position and Mode inputs. If a motor is associated with the axis, it will not move when MC_SetPos is executed. MC_SetPos does not cause any motion. It applies an offset to the command and actual positions.

MC_SetPos also sets the accumulated Superimposed distance value for the input axis to 0. See the table in Axis Positions Data.

This function block replaces the MC_SetPosition function.

Figure 7-156: MC_SetPos

Arguments

For more detail on how inputs and outputs work, refer to PLCopenClosedA vendor -and product- independent worldwide association active in Industrial Control and aiming at standardizing PLC file formats based on XML Function Blocks - General Rules.

Inputs

Execute Description Requests to change the axis position
  Data type BOOL
  Range 0,1
  Unit N/A
  Default
Axis Description Name of a declared instance of the AXIS_REF library function. For more details Modify PLCopen Axis.
  Data type AXIS_REF Structure
  Range [1,256]
  Unit N/A
  Default
Position Description Absolute Mode: New Axis Position to replace the present position.
Relative Mode: Position offset to apply to present position (typically used with multiturn absolute position feedback devices).
  Data type LREAL
  Range
  Unit N/A
  Default
Mode Description LOW = Position input is an absolute position
HIGH = Position input is a relative position
  Data type BOOL
  Range
  Unit N/A
  Default

Outputs

Done Description Indicates the reference move and position adjustment is complete
Data type BOOL
Busy Description Indicates this function block is executing
  Data type BOOL
Error Description Indicates an invalid input, or the move was terminated due to an error
  Data type BOOL
ErrorID Description Indicates the error if the Error output is high See table in PLCopen Function Block ErrorID Output
  Data type INT

Example

Structured Text

            (* 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

Ladder Diagram


  • This function block finishes immediately. Due to finishing immediately, 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 your application needs to look for a state change to determine if a particular call to MC_SetPos was successful, then one should AND the rising edgeClosedA rising edge is the transition of a digital signal from low to high. It is also called positive edge of the Execute input, the Done output, and the inverse of the Error output.

    The FFLD example below shows how this can be done. In the example, the 'SetPosSuccessful' variable will be set to TRUE for one cycle upon a successful call to the MC_SetPos instance.

Go back to the top of the page [Top]