• Rotation Slide

Using a State Machine to Control AMCI Motion Device

A State Machine steps through a sequence of tasks based on values from previous states and or user inputs.  

The following document shows how to use State Machine logic to command an AMCI Motion device to perform a back and forth move profile. 

In this example, each state increases by 10 instead of by 1.  This is a common practice and allows a new intermediate state to be easily inserted between two existing states without having to modify the entire program. 

In addition to the State Machine, this document also uses AMCI’s Motion Axis AOIs to send commands to the Motion Device.  

 

Follow these steps:

At the top of the program, BEFORE ALL OF THE ADD ON INSTRUCTIONS, use a CPS instruction to copy the input data from the AMCI motion device to a tag array that was created using the AMCI_Motion_Axis_Input_Data User Defined Data Type. 

The input data in this tag array is made up of named tags and will also be used as the buffered data in your program.  It is this buffered data that must be used in place of the input data directly from the AMCI motion device.     

 

 

When tag STATE is equal to 10, start the clockwise Relative Move. 

  

 

When clockwise motion is occurring and tag STATE is equal to 10, change tag STATE to 20.   

  

 

When CW motion has stopped and tag STATE is equal to 20, change tag STATE to 30.

  

 

When tag STATE is equal to 30, start the Counter Clockwise Relative Move. 

A negative number in the Position_or_Distance field is what causes a Relative Move to occur in the Counter Clockwise direction  

 

When counter clockwise motion is occurring and tag STATE is equal to 30, change tag STATE to 40.   

  

 

When motion has stopped and tag STATE is equal to 40, change tag STATE to 0. 

The back and forth operation is now complete.     

  

 

At the bottom of the program, after all of the Add On Instructions, use a CPS instruction to copy the output data from the AOIs to the output registers of the AMCI motion device.   

The tag array in the CPS Instruction’s Source field was created using the AMCI_Motion_Axis_Output_Data User Defined Data Type.