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

MW_PlcSetPosition2

Previous pageReturn to chapter overviewNext page

Block to configure the current position of the axis.

 

Ladder Representation

 

MW_PlcSetPosition2_G0

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

PositionAxis1

DINT

Desired position for axis 1

PositionAxis2

DINT

Desired position for axis 2

VAR_OUTPUT

ENO

BOOL

Output enabling

VAR

MW_PlcSetPosition2_INST_0

MW_PlcSetPosition2

Instance of access to block structure

 

Operation

 

When the EN input changes from FALSE to TRUE (rising edge), the block configures the current position of the axes according to the value of the "positionAxis" variables.

 

wpshelp_common_fig_note

NOTE!

The stepper motor control must be enabled for both axes. Look at the user manual and parameter manual.

 

Example in Ladder

 

MW_PlcSetPosition2_example01

In the example above, the "set" contact changes the current position of the axes (5000, 10000).

 

The "read" contact enables the reading of the current position of the axes, allowing you to monitor the changes made.

 

Example in ST

 

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

 

 

VAR

   set : BOOL := 1;

   read : BOOL := 1;

   doneReading : BOOL;

   setPos1 : DINT := 5000;

   setPos2 : DINT := 10000;

   readPos1 : DINT := 0 ;

   readPos2 : DINT := 0 ;

   PTSCONTACT_INST_0 : FB_PTSCONTACT;

   MW_PlcSetPosition2_INST_0 : FB_MW_PlcSetPosition2;

END_VAR

 

PTSCONTACT_INST_0(EN:=TRUE, BIT:=set);

 

MW_PlcSetPosition2_INST_0(

   EN:=PTSCONTACT_INST_0.Q,

   PositionAxis1:=setPos1,

   PositionAxis2:=setPos2);

 

doneReading := FB_MW_PlcGetPosition2(

   EN:=read,

   PositionAxis1=>readPos1,

   PositionAxis2=>readPos2);