(*********************************************

  Import-Export
  Version   := RSLogix 5000 v32.05
  Owner     := , 
  Exported  := Tue Nov 19 11:58:26 2024

  Note:  File encoded in UTF-8.  Only edit file in a program 
         which supports UTF-8 (like Notepad, not Wordpad).

**********************************************)
IE_VER := 2.23;

CONTROLLER SD_Jog (ProcessorType := "1769-L16ER-BB1B",
                   Major := 32,
                   TimeSlice := 20,
                   ShareUnusedTimeSlice := 1,
                   CommPath := "USB\16",
                   RedundancyEnabled := 0,
                   KeepTestEditsOnSwitchOver := 0,
                   DataTablePadPercentage := 50,
                   SecurityCode := 0,
                   ChangesToDetect := 16#ffff_ffff_ffff_ffff,
                   SFCExecutionControl := "CurrentActive",
                   SFCRestartPosition := "MostRecent",
                   SFCLastScan := "DontScan",
                   SerialNumber := 16#6096_b85e,
                   MatchProjectToController := No,
                   CanUseRPIFromProducer := No,
                   InhibitAutomaticFirmwareUpdate := 0,
                   PassThroughConfiguration := EnabledWithAppend,
                   DownloadProjectDocumentationAndExtendedProperties := Yes,
                   ReportMinorOverflow := 0)
	MODULE Local (Parent := "Local",
	              ParentModPortId := 1,
	              CatalogNumber := "1769-L16ER-BB1B",
	              Vendor := 1,
	              ProductType := 14,
	              ProductCode := 153,
	              Major := 32,
	              Minor := 15,
	              PortLabel := "RxBACKPLANE",
	              ChassisSize := 2,
	              Slot := 0,
	              Mode := 2#0000_0000_0000_0001,
	              CompatibleModule := 0,
	              KeyMask := 2#0000_0000_0000_0000)
	END_MODULE

	MODULE Discrete_IO (Parent := "Local",
	                    ParentModPortId := 1,
	                    CatalogNumber := "Embedded",
	                    Vendor := 1,
	                    ProductType := 7,
	                    ProductCode := 1140,
	                    Major := 32,
	                    Minor := 11,
	                    PortLabel := "RxBACKPLANE",
	                    Slot := 1,
	                    Mode := 2#0000_0000_0000_0001,
	                    CompatibleModule := 1,
	                    KeyMask := 2#0000_0000_0001_1111)
			ExtendedProp := [[[___<public><ConfigID>100</ConfigID><CatNum>Embedded</CatNum></public>___]]]
			ConfigData  := [84,113,1,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000
		,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,0,0,0,0,0,0];
			CONNECTION Data (Rate := 20000,
			                 EventID := 0,
			                 Unicast := No)
					InputData  := [0,0];
					OutputData  := [0];
			END_CONNECTION

	END_MODULE

	MODULE ClearLink (Parent := "Local",
	                  ParentModPortId := 2,
	                  CatalogNumber := "01A8_002B_0001",
	                  Vendor := 424,
	                  ProductType := 43,
	                  ProductCode := 1,
	                  Major := 2,
	                  Minor := 92,
	                  PortLabel := "ENet",
	                  NodeAddress := "192.168.3.5",
	                  Mode := 2#0000_0000_0000_0000,
	                  CompatibleModule := 1,
	                  KeyMask := 2#0000_0000_0001_1111,
	                  SafetyEnabled := 0)
			ExtendedProp := [[[___<public><PL>02<Version Name=$Q1.1$Q/></PL><CatNum></CatNum><DataTypeFormats><DataTypeFormat Format=$Q1$Q Type=$QConfig$Q/><DataTypeFormat InstanceApplicationPath=$Q20 04 2C 64 30 03$Q Format=$Q1$Q Type=$QInput$Q/><DataTypeFormat InstanceApplicationPath=$Q20 04 2C 70 30 03$Q Format=$Q1$Q Type=$QOutput$Q/></DataTypeFormats></public>___]]]
			ConfigData  := [240,4,100,100,100,100,100,0,0,10,10,10,10,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000
		,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10000,10,10,10
		,10,10,10,10,10,100,5,0,0,0,8,1,1,10000000,0,0,-1,-1,-1,-1,-1,-1,-1,0,8,1,1,10000000,0,0,-1,-1,-1,-1,-1,-1,-1,0,8,1,1,10000000
		,0,0,-1,-1,-1,-1,-1,-1,-1,0,8,1,1,10000000,0,0,-1,-1,-1,-1,-1,-1,-1,0,115200,0,0,0,0,10];
			ConfigScript (Size := 1612) := [70,6,0,0,4,0,0,0,0,0,0,0,0,0,0,0,54,6,0,0,7,1,0,0,0,3,0,0,0,-24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,8,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,16,0,0,0,16,0,0,0,8,0,0,0,24,0,0,0,24,0,0,0
		,8,0,0,0,32,0,0,0,32,0,0,0,16,0,0,0,48,0,0,0,40,0,0,0,8,0,0,0,64,0,0,0,56,0,0,0,8,0,0,0,72,0,0,0,64,0,0,0,8,0,0,0,80,0,0,0,72,0,0,0,8,0,0,0,88,0,0,0,80
		,0,0,0,8,0,0,0,96,0,0,0,88,0,0,0,16,0,0,0,112,0,0,0,96,0,0,0,16,0,0,0,-128,0,0,0,112,0,0,0,16,0,0,0,-112,0,0,0,-128,0,0,0,16,0,0,0,-96,0,0,0
		,-112,0,0,0,16,0,0,0,-80,0,0,0,-96,0,0,0,16,0,0,0,-64,0,0,0,-80,0,0,0,16,0,0,0,-48,0,0,0,-64,0,0,0,16,0,0,0,-32,0,0,0,-48,0,0,0,16,0,0,0,-16
		,0,0,0,-32,0,0,0,16,0,0,0,0,1,0,0,-16,0,0,0,16,0,0,0,16,1,0,0,0,1,0,0,16,0,0,0,32,1,0,0,16,1,0,0,16,0,0,0,48,1,0,0,32,1,0,0,16,0,0,0,64,1,0,0,48,1
		,0,0,16,0,0,0,80,1,0,0,64,1,0,0,16,0,0,0,96,1,0,0,80,1,0,0,16,0,0,0,112,1,0,0,96,1,0,0,16,0,0,0,-128,1,0,0,112,1,0,0,16,0,0,0,-112,1,0,0,-128
		,1,0,0,16,0,0,0,-96,1,0,0,-112,1,0,0,16,0,0,0,-80,1,0,0,-96,1,0,0,16,0,0,0,-64,1,0,0,-80,1,0,0,16,0,0,0,-48,1,0,0,-64,1,0,0,16,0,0,0,-32,1
		,0,0,-48,1,0,0,16,0,0,0,-16,1,0,0,-32,1,0,0,16,0,0,0,0,2,0,0,-16,1,0,0,8,0,0,0,16,2,0,0,0,2,0,0,8,0,0,0,24,2,0,0,8,2,0,0,8,0,0,0,32,2,0,0,16,2,0,0,8
		,0,0,0,40,2,0,0,24,2,0,0,8,0,0,0,48,2,0,0,32,2,0,0,8,0,0,0,56,2,0,0,40,2,0,0,8,0,0,0,64,2,0,0,48,2,0,0,8,0,0,0,72,2,0,0,56,2,0,0,32,0,0,0,96,2,0,0,64
		,2,0,0,8,0,0,0,-128,2,0,0,96,2,0,0,8,0,0,0,-120,2,0,0,104,2,0,0,8,0,0,0,-112,2,0,0,112,2,0,0,8,0,0,0,-104,2,0,0,120,2,0,0,32,0,0,0,-96,2,0,0
		,-128,2,0,0,32,0,0,0,-64,2,0,0,-96,2,0,0,32,0,0,0,-32,2,0,0,-64,2,0,0,32,0,0,0,0,3,0,0,-32,2,0,0,32,0,0,0,32,3,0,0,0,3,0,0,32,0,0,0,64,3,0,0,32
		,3,0,0,8,0,0,0,96,3,0,0,64,3,0,0,8,0,0,0,104,3,0,0,72,3,0,0,8,0,0,0,112,3,0,0,80,3,0,0,8,0,0,0,120,3,0,0,88,3,0,0,8,0,0,0,-128,3,0,0,96,3,0,0,8,0,0
		,0,-120,3,0,0,104,3,0,0,8,0,0,0,-112,3,0,0,112,3,0,0,8,0,0,0,-104,3,0,0,120,3,0,0,32,0,0,0,-96,3,0,0,-128,3,0,0,32,0,0,0,-64,3,0,0,-96,3
		,0,0,32,0,0,0,-32,3,0,0,-64,3,0,0,32,0,0,0,0,4,0,0,-32,3,0,0,32,0,0,0,32,4,0,0,0,4,0,0,32,0,0,0,64,4,0,0,32,4,0,0,8,0,0,0,96,4,0,0,64,4,0,0,8,0,0,0
		,104,4,0,0,72,4,0,0,8,0,0,0,112,4,0,0,80,4,0,0,8,0,0,0,120,4,0,0,88,4,0,0,8,0,0,0,-128,4,0,0,96,4,0,0,8,0,0,0,-120,4,0,0,104,4,0,0,8,0,0,0,-112
		,4,0,0,112,4,0,0,8,0,0,0,-104,4,0,0,120,4,0,0,32,0,0,0,-96,4,0,0,-128,4,0,0,32,0,0,0,-64,4,0,0,-96,4,0,0,32,0,0,0,-32,4,0,0,-64,4,0,0,32,0
		,0,0,0,5,0,0,-32,4,0,0,32,0,0,0,32,5,0,0,0,5,0,0,32,0,0,0,64,5,0,0,32,5,0,0,8,0,0,0,96,5,0,0,64,5,0,0,8,0,0,0,104,5,0,0,72,5,0,0,8,0,0,0,112,5,0,0,80
		,5,0,0,8,0,0,0,120,5,0,0,88,5,0,0,8,0,0,0,-128,5,0,0,96,5,0,0,8,0,0,0,-120,5,0,0,104,5,0,0,8,0,0,0,-112,5,0,0,112,5,0,0,8,0,0,0,-104,5,0,0,120
		,5,0,0,32,0,0,0,-96,5,0,0,-128,5,0,0,32,0,0,0,-64,5,0,0,-96,5,0,0,32,0,0,0,-32,5,0,0,-64,5,0,0,32,0,0,0,0,6,0,0,-32,5,0,0,32,0,0,0,32,6,0,0,0
		,6,0,0,32,0,0,0,64,6,0,0,32,6,0,0,8,0,0,0,96,6,0,0,64,6,0,0,8,0,0,0,104,6,0,0,72,6,0,0,8,0,0,0,112,6,0,0,80,6,0,0,8,0,0,0,120,6,0,0,88,6,0,0,8,0,0,0
		,-128,6,0,0,96,6,0,0,8,0,0,0,-120,6,0,0,104,6,0,0,8,0,0,0,-112,6,0,0,112,6,0,0,8,0,0,0,-104,6,0,0,120,6,0,0,32,0,0,0,-96,6,0,0,-128,6,0,0
		,32,0,0,0,-64,6,0,0,-96,6,0,0,32,0,0,0,-32,6,0,0,-64,6,0,0,32,0,0,0,0,7,0,0,-32,6,0,0,32,0,0,0,32,7,0,0,0,7,0,0,32,0,0,0,64,7,0,0,32,7,0,0,0,0];
			CONNECTION _200424962C702C64 (Rate := 10000,
			                              InputSize := 336,
			                              OutputSize := 280,
			                              EventID := 0,
			                              Priority := Scheduled,
			                              InputConnectionType := Unicast,
			                              InputProductionTrigger := Cyclic,
			                              ConnectionPath := "20 04 24 96 2c 70 2c 64",
			                              InputTagSuffix := "I1",
			                              OutputTagSuffix := "O1")
					InputData  := [0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,-260992,0,0,0,0,-9.99900000e+003,17412,0,0,0,0,0,0,-9.99900000e+003
		,4096,0,0,0,0,0,0,-9.99900000e+003,4096,0,0,0,0,0,0,-9.99900000e+003,4096,0,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
					OutputData  := [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50000,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
			END_CONNECTION

	END_MODULE

	TAG
	END_TAG

	PROGRAM MainProgram (MAIN := "SD_Jog",
	                     MODE := 0,
	                     DisableFlag := 0,
	                     UseAsFolder := 0)
		TAG
			ACCUMULATED_SHUTDOWN_HISTORY : DINT (RADIX := Binary) := 1025;
			Block : BOOL (RADIX := Decimal) := 0;
			CURRENT_MOTOR_STATUS : DINT (RADIX := Binary) := 17412;
			CURRENT_STATE : DINT (RADIX := Decimal) := 1;
			Motor_Moving_At_Target_Velocity : BOOL (RADIX := Decimal) := 0;
			Motor_Stopped : BOOL (RADIX := Decimal) := 1;
			Move_Acceleration : DINT (RADIX := Decimal) := 50000;
			Move_Velocity_Negative : DINT (RADIX := Decimal) := -5000;
			Move_Velocity_Positive : DINT (RADIX := Decimal) := 5000;
			Negative_Jog_Button_Pressed : BOOL (RADIX := Decimal) := 0;
			Positive_Jog_Button_Pressed : BOOL (RADIX := Decimal) := 0;
			STATE_CLEARLINK_SHUTDOWN : DINT (RADIX := Decimal) := 8;
			STATE_ENABLING : DINT (RADIX := Decimal) := 0;
			STATE_MOTOR_SHUTDOWN : DINT (RADIX := Decimal) := 7;
			STATE_MOVING_NEGATIVE : DINT (RADIX := Decimal) := 5;
			STATE_MOVING_POSITIVE : DINT (RADIX := Decimal) := 4;
			STATE_STARTING_NEGATIVE_MOVE : DINT (RADIX := Decimal) := 3;
			STATE_STARTING_POSITIVE_MOVE : DINT (RADIX := Decimal) := 2;
			STATE_STARTING_STOP_MOVE : DINT (RADIX := Decimal) := 6;
			STATE_STOPPED : DINT (RADIX := Decimal) := 1;
		END_TAG

		ROUTINE SD_Jog 
				RC: "*******************************************************************************************************************************************************************************************$N"
				    "Program Name: SD_Velocity_Move (One Axis)$N"
				    "Program Description: This program allows a user to jog a ClearPath SD motor back and forth using the digital inputs DI-7 (Positive Jog Button) and DI-6 (Negative Jog Button).$N"
				    "Motor Required: One ClearPath-SD (Step & Direction) motor connected to ClearLink at connector M-0.$N"
				    "Software Used: Studio 5000 Logix Designer (Version 32.02.00 was used to create this routine).$N"
				    "Controller Used: Allen-Bradley CompactLogix Controller / Model #: 1769-L16ER-BB1B was used to create this example. $N"
				    "Additional Hardware Used: Two digital switches or other hardware device to toggle digital inputs.$N"
				    "*******************************************************************************************************************************************************************************************$N"
				    "BEFORE RUNNING THIS EXAMPLE, your ClearPath-SD motor must first be configured in MSP (ClearPath Motor Setup Program). See the ClearLink Software Object Data Reference for motor setup and configuration instructions: https://www.teknic.com/files/downloads/clearlink_ethernet-ip_object_reference.pdf. $N"
				    "***IMPORTANT*** FAILURE TO PROPERLY TUNE AND CONFIGURE YOUR CLEARPATH MOTOR BEFORE USE MAY RESULT IN UNEXPECTED MOTION, OR NO MOTION.$N"
				    "*******************************************************************************************************************************************************************************************$N"
				    "$N"
				    "**********************BEGIN RUNG COMMENTS**********************$N"
				    "$N"
				    "• Map the value of DI-6 to the local tag Negative Move Button Pressed.  $N"
				    "• Mapping the I/O is not required, but has been included to make the example easier to understand.    $N"
				    "";
				N: XIC(ClearLink:I1.DIP_Value.6)OTE(Negative_Jog_Button_Pressed);
				RC: "• Map the value of DI-7 to the local tag Positive Move Button Pressed.  $N"
				    "• Mapping the I/O is not required, but has been included to make the example easier to understand.    ";
				N: XIC(ClearLink:I1.DIP_Value.7)OTE(Positive_Jog_Button_Pressed);
				RC: "• Enable Motor 0. CAUTION: Enabled motors can output torque and move in response to motion commands.$N"
				    "$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_ENABLING)OTL(ClearLink:O1.Motor0_Output_Reg_Enable)XIC(ClearLink:I1.Motor0_Status_Enabled)MOV(STATE_STOPPED,CURRENT_STATE);
				RC: "• While the motor is stopped, check the state of the control I/O. If the Positive Move Button has been pressed, set Move Velocity, and Move Acceleration. $N"
				    "• A move is sent when the Load Velocity Data bit is set. This element remains latched until the $Qack$Q is received by ClearLink.$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_STOPPED)XIC(Positive_Jog_Button_Pressed)XIO(Negative_Jog_Button_Pressed)MOV(Move_Velocity_Positive,ClearLink:O1.Motor0_Jog_Vel)MOV(Move_Acceleration,ClearLink:O1.Motor0_Accel_Lim)OTL(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_STARTING_POSITIVE_MOVE,CURRENT_STATE);
				RC: "• While the motor is stopped, check the state of the control I/O. If the Negative Move Button has been pressed, set Move Velocity, and Move Acceleration. $N"
				    "• A move is sent when the Load Velocity Data bit is set. This element remains latched until the $Qack$Q is received by ClearLink.$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_STOPPED)XIC(Negative_Jog_Button_Pressed)XIO(Positive_Jog_Button_Pressed)MOV(Move_Velocity_Negative,ClearLink:O1.Motor0_Jog_Vel)MOV(Move_Acceleration,ClearLink:O1.Motor0_Accel_Lim)OTL(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_STARTING_NEGATIVE_MOVE,CURRENT_STATE);
				RC: "• When the Move ack is received, the Load Velocity Data element is UNLATCHED allowing the next move to be commanded. $N"
				    "";
				N: EQU(CURRENT_STATE,STATE_STARTING_POSITIVE_MOVE)XIC(ClearLink:I1.Motor0_Status_Load_Vel_Move_Ack)OTU(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_MOVING_POSITIVE,CURRENT_STATE);
				RC: "• When the Move ack is received, the Load Velocity Data element is UNLATCHED allowing the next move to be commanded. $N"
				    "";
				N: EQU(CURRENT_STATE,STATE_STARTING_NEGATIVE_MOVE)XIC(ClearLink:I1.Motor0_Status_Load_Vel_Move_Ack)OTU(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_MOVING_NEGATIVE,CURRENT_STATE);
				RC: "• While the motor is moving in the positive direction, check the state of the control I/O. If the Positive Move Button has been released or both control buttons have been pressed, set Move Velocity, and Move Acceleration. $N"
				    "• A move is sent when the Load Velocity Data bit is set. This element remains latched until the $Qack$Q is received by ClearLink.$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_MOVING_POSITIVE)[XIO(Positive_Jog_Button_Pressed) ,XIC(Negative_Jog_Button_Pressed) ]MOV(0,ClearLink:O1.Motor0_Jog_Vel)MOV(Move_Acceleration,ClearLink:O1.Motor0_Accel_Lim)OTL(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_STARTING_STOP_MOVE,CURRENT_STATE);
				RC: "• While the motor is moving in the negative direction, check the state of the control I/O. If the Negative Move Button has been released or both control buttons have been pressed, set Move Velocity, and Move Acceleration. $N"
				    "• A move is sent when the Load Velocity Data bit is set. This element remains latched until the $Qack$Q is received by ClearLink.$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_MOVING_NEGATIVE)[XIO(Negative_Jog_Button_Pressed) ,XIC(Positive_Jog_Button_Pressed) ]MOV(0,ClearLink:O1.Motor0_Jog_Vel)MOV(Move_Acceleration,ClearLink:O1.Motor0_Accel_Lim)OTL(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_STARTING_STOP_MOVE,CURRENT_STATE);
				RC: "• When the Move ack is received, the Load Velocity Data element is UNLATCHED allowing the next move to be commanded. $N"
				    "";
				N: EQU(CURRENT_STATE,STATE_STARTING_STOP_MOVE)XIC(ClearLink:I1.Motor0_Status_Load_Vel_Move_Ack)OTU(ClearLink:O1.Motor0_Output_Reg_Load_Vel_Data)MOV(STATE_STOPPED,CURRENT_STATE);
				RC: "*******************************************************************************************************************************************************************************************$N"
				    "$N"
				    "The next section of ladder code demonstrates how to properly handle clearing motor faults and ClearLink shutdowns.$N"
				    "$N"
				    "*******************************************************************************************************************************************************************************************$N"
				    "$N"
				    "$N"
				    "• Check for motor faults. If present, attempt to clear using the Clear_Fault instruction (Note: the Clear_Fault instruction will rapidly cycle the motor$'s Enable Input).$N"
				    "*** NOTE TO USER: If motor faults persist (are not clearable), troubleshoot ClearPath motor using MSP software. $N"
				    "To make troubleshooting easier, this rung does not Clear Motor Faults by default. To enable the remainder of this rung, turn on the Block tag. $N"
				    "$N"
				    "";
				N: XIC(ClearLink:I1.Motor0_Status_Motor_In_Fault)MOV(STATE_MOTOR_SHUTDOWN,CURRENT_STATE)XIC(Block)OTE(ClearLink:O1.Motor0_Output_Reg_Clear_Fault);
				RC: "• Check that the motor is no longer in fault.  $N"
				    "$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_MOTOR_SHUTDOWN)XIO(ClearLink:I1.Motor0_Status_Motor_In_Fault)MOV(STATE_ENABLING,CURRENT_STATE);
				RC: "• Check for ClearLink shutdowns. If shutdowns are present, attempt to clear using Clear_Alerts bit. Note: uncleared shutdowns will prevent further motion.$N"
				    "***NOTE TO USER: To identify the cause of persisting shutdowns, check ClearLink Shutdown Register (ClearLink:I1.Motor0_Shutdowns).$N"
				    "To make troubleshooting easier, this rung does not Clear Alerts by default. To enable the remainder of this rung, turn on the Block tag. $N"
				    "$N"
				    "";
				N: XIC(ClearLink:I1.Motor0_Status_Shutdowns_Pres)XIO(ClearLink:I1.Motor0_Status_Motor_In_Fault)MOV(STATE_CLEARLINK_SHUTDOWN,CURRENT_STATE)XIC(Block)OTE(ClearLink:O1.Motor0_Output_Reg_Clear_Alerts);
				RC: "• Check that the motor no longer has alerts present.  $N"
				    "$N"
				    "";
				N: EQU(CURRENT_STATE,STATE_CLEARLINK_SHUTDOWN)XIO(ClearLink:I1.Motor0_Status_Shutdowns_Pres)MOV(STATE_ENABLING,CURRENT_STATE);
				RC: "*******************************************************************************************************************************************************************************************$N"
				    "$N"
				    "The rest of this ladder is not required, but calls out useful tags for troubleshooting. $N"
				    "$N"
				    "*******************************************************************************************************************************************************************************************$N"
				    "$N"
				    "• Checks if motor 0 is at its target velocity and if steps are being sent. $N"
				    "***NOTE TO USER: This combination is commonly used to determine if the motor is moving at target velocity. $N"
				    "";
				N: XIC(ClearLink:I1.Motor0_Status_At_Vel)XIC(ClearLink:I1.Motor0_Status_Steps_Active)OTE(Motor_Moving_At_Target_Velocity);
				RC: "• Checks if motor 0 is enabled and if steps are not being sent. $N"
				    "***NOTE TO USER: This combination is commonly used to determine if the motor is stopped.$N"
				    "";
				N: XIC(ClearLink:I1.Motor0_Status_Enabled)XIO(ClearLink:I1.Motor0_Status_Steps_Active)OTE(Motor_Stopped);
				RC: "• If there are any shutdowns present, set the corresponding bit of the Accumulated Shutdown History. The Accumulated Shutdown History is a collection of all shutdowns that have occurred since the program began. $N"
				    "***NOTE TO USER: Many of the bits in the Motor Shutdown Register can be accessed directly through tags in the input assembly. $N"
				    "";
				N: XIC(ClearLink:I1.Motor0_Status_Shutdowns_Pres)OR(ACCUMULATED_SHUTDOWN_HISTORY,ClearLink:I1.Motor0_Shutdowns,ACCUMULATED_SHUTDOWN_HISTORY);
				RC: "• Gets the motor$'s status register and moves it into a local tag where it is easily accessible. This register shows the current status of the motor. $N"
				    "***NOTE TO USER: Many of the bits in this register can be accessed directly through tags in the input assembly.";
				N: MOV(ClearLink:I1.Motor0_Status,CURRENT_MOTOR_STATUS);
		END_ROUTINE

		CHILD_PROGRAMS
		END_CHILD_PROGRAMS

	END_PROGRAM

	TASK MainTask (Type := CONTINUOUS,
	               Rate := 10,
	               Priority := 10,
	               Watchdog := 500,
	               DisableUpdateOutputs := No,
	               InhibitTask := No)
			MainProgram;
	END_TASK

CONFIG CST(SystemTimeMasterID := 0) END_CONFIG

CONFIG EthernetNetwork(SupervisorModeEnabled := 0,
	                                 SupervisorPrecedence := 0,
	                                 BeaconInterval := 400,
	                                 BeaconTimeout := 1960,
	                                 VLANID := 0) END_CONFIG

CONFIG EthernetPort1(Label := "1",
	                             PortEnabled := 1) END_CONFIG

CONFIG EthernetPort2(Label := "2",
	                             PortEnabled := 1) END_CONFIG

CONFIG TimeSynchronize(Priority1 := 128,
	                                 Priority2 := 128,
	                                 PTPEnable := 0) END_CONFIG

CONFIG WallClockTime(LocalTimeAdjustment := 0,
	                     TimeZone := 0) END_CONFIG

END_CONTROLLER

