MC_SetPos
Description
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.
-
-
This function or function block returns cached data. See Programming a Dual Core Controller for more information.
-
- This function block starts a motion-related action and therefore stores data for calculations and error checking. Please see Calling Function Blocks Multiple Times in the Same Cycle if you are using a dual-core controller.
Arguments
For more detail on how inputs and outputs work, refer to PLCopenA 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 ST"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 shouldAND
the rising edgeA 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 toTRUE
for one cycle upon a successful call to the MC_SetPos instance.