Danfoss MCO 305 Design Manual page 23

Programmable motion controller
Hide thumbs Also See for MCO 305:
Table of Contents

Advertisement

MCO 305 Design Guide
Program Example: Touch Probe Positioning for Palletizer Application
/******** Touch probe positioning sample program for palletizer application example *********/
//
Inputs:
1
Go to position
//
2
Touch probe
//
8
Clear Error
//
Outputs:
1
In position
//
8
Error
/********************************* Interrupts ************************************/
ON ERROR GOSUB errhandle
ON INT 2 GOSUB tp_handler
/*******************************
flag = 0
tp_active = 0
/*****************************
VEL 80
// Sets positioning velocity related to parameter 32-80 Maximum velocity.
ACC 100
// Sets positioning acceleration related to parameter 32-81 Shortest ramp.
DEC 100
// Sets positioning deceleration related to parameter 32-81 Shortest ramp.
/************************** Define application parameters ***************************/
LINKGPAR 1900 "Touch probe distance" 0 1073741823 0
/******************************* main loop **************************************/
MAIN:
IF (IN 1 == 1) AND (flag == 0) THEN
OUT 1 0
CVEL 80
CSTART
tp_active = 0
flag = 1
ELSE
MOTOR STOP
flag = 0
ENDIF
GOTO MAIN
/****************************** Sub programs start *******************************/
SUBMAINPROG
/****************************** Touch probe handler ******************************/
SUBPROG tp_handler
IF (tp_active == 0) THEN
POSR (GET 1900)
WAITAX
OUT 1 1
tp_active = 1
ENDIF
RETURN
/******************************** Error handler *********************************/
SUBPROG errhandle
err = 1
OUT 8 1
WHILE err DO
IF IN 8 THEN
ERRCLR
err=0
ENDIF
ENDWHILE
OUT 8 0
flag = 0
RETURN
/*****************************************************************************/
ENDPROG
/******************************** End of program ********************************/
__ Functions and Examples __
// In case of error go to error handler routine, this must always be included
// Call touch probe handler on positive edge of input 2.
Define flags ***********************************/
Basic settings
// Start movement once (ensured by flag) when input 1 is high.
// Reset "In position" output.
// Set constant velocity.
// Start with constant velocity.
// Reset "tp_active" to enable new touch probe positioning.
// Set "flag" to ensure that distance is only traveled once.
// Stop if input is low.
// Reset "flag" to enable new start.
// Go to touch probe target position
// Halt program execution until position is reached (This is necessary as
// NOWAIT ON is automatically set in a subroutine called by interrupt).
// Set "In position" output.
// Set "tp_active" to ensure that touch probe positioning is done only once
// Set error flag to remain in error handler until error is reset.
// Set error output.
// Remain in error handler until the reset is received.
// Reset error when Input 8 is high.
// Clear error.
// Reset error flag.
// Reset error output.
// Reset "flag" to enable new positioning.
®
MG.33.L5.02 – VLT
is a registered Danfoss trademark
**********************************/
23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents