Navigation:  Equipments (Devices) > PLC200 > Program > Motion - Stepper Motor >

MW_PlcGetPosition1

Previous pageReturn to chapter overviewNext page

Block to read the current position of the axis.

 

Ladder Representation

 

MW_PlcGetPosition1_G0

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

AxisNumber

CONST

Selected axis

VAR_OUTPUT

ENO

BOOL

Output enabling

Position

DINT

Current position

VAR

MW_PlcGetPosition1_INST_0

MW_PlcGetPosition1

Instance of access to block structure

 

Operation

 

When the EN input is TRUE, the block reads the current position of the axis and saves it in the variable "Position".

 

wpshelp_common_fig_note

NOTE!

Stepper motor control must be enabled for the selected axis. Look at the user manual and parameter manual.

 

Example in Ladder

 

MW_PlcGetPosition1_example01

In the example above the contact "read" enables reading of the current position of axis 1. While "read" is TRUE, the variable "pos" will be updated with the value of the current axis position.

 

Example in ST

 

 The example below displays instructions for applying the example above in ST language.

 

 

VAR

   enable : BOOL := 1 ;

   done : BOOL;

   pos : DINT := 0 ;

END_VAR

 

done := FB_MW_PlcGetPosition1(

   EN:=enable,

   AxisNumber:=1 ,

   Position=>pos);