MCO 305 Design Guide__ Functions and Examples __20 MG.33.L5.02 – VLT® is a registered Danfoss trademarkProgram Example: Absolute Positioning for Palletizer Application/********************** Absolute Positioning program sample **************************/// Inputs: 1 Go to pick up position// 2 Goto deliver position// 3 Home switch// 8 Clear Error// Outputs: 1 In pick up position// 2 In deliver position// 8 Error/****************************** Interrupts **************************************/ON ERROR GOSUB errhandle// In case of error go to error handler routine, this must always be included/**************************** Basic settings ***********************************/VEL 80 // Sets positioning velocity related to par. 32-80 Maximum velocityACC 100 // Sets positioning acceleration related to par. 32-81 Shortest rampDEC 100 // Sets positioning deceleration related to par. 32-81 Shortest ramp/*********************** Define application parameters *****************************/LINKGPAR 1900 "Pick up Position" 0 1073741823 0LINKGPAR 1901 "Deliver Position" 0 1073741823 0/****************** Define Home(0) position after power up *************************/SET I_FUNCTION_3 1 // Define input 3 as Home switch inputHOME // Go to Home and set position to 0/****************************** main loop **************************************/MAIN:IF (IN 1 == 1) AND (IN 2 == 0) THEN // Go to pick up position when only input 1 is highOUT 2 0 // Reset "In deliver position" outputPOSA (GET 1900) // Go to positionOUT 1 1 // Set "In pick up position" outputELSEIF (IN 1 == 0) AND (IN 2 == 1) THEN // Go to deliver position when only input 2 is highOUT 1 0 // Reset "In pick up position" outputPOSA (GET 1901) // Go to positionOUT 2 1 // Set "In deliver position" outputELSEMOTOR STOP // Stop if both inputs are low or high.ENDIFGOTO MAIN/*********************** Sub programs start *************************************/SUBMAINPROG/************************* Error handler ****************************************/SUBPROG errhandleerr = 1 // Set error flag to remain in error handler until error is reset.OUT 8 1 // Set error outputWHILE err DO // Remain in error handler until the reset is receivedIF IN 8 THEN // Reset error when Input 8 is high.ERRCLR // Clear errorerr=0 // Reset error flagENDIFENDWHILEOUT 8 0 // Reset error outputRETURN/*****************************************************************************/ENDPROG/*************************** End of program ************************************/