
MCO 305 Design Guide
__ Functions and Examples __
20
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
Program 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 velocity
ACC
100
// Sets positioning acceleration related to par. 32-81 Shortest ramp
DEC
100
// Sets positioning deceleration related to par. 32-81 Shortest ramp
/*********************** Define application parameters *****************************/
LINKGPAR
1900 "Pick up Position" 0 1073741823 0
LINKGPAR
1901 "Deliver Position" 0 1073741823 0
/****************** Define Home(0) position after power up *************************/
SET
I_FUNCTION_3 1
// Define input 3 as Home switch input
HOME
// 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 high
OUT
2 0
// Reset "In deliver position" output
POSA
(
GET
1900)
// Go to position
OUT
1 1
// Set "In pick up position" output
ELSEIF
(
IN
1
==
0
) AND (
IN
2 == 1
)
THEN
// Go to deliver position when only input 2 is high
OUT
1 0
// Reset "In pick up position" output
POSA
(
GET
1901
)
// Go to position
OUT
2 1
// Set "In deliver position" output
ELSE
MOTOR
STOP
// Stop if both inputs are low or high.
ENDIF
GOTO MAIN
/*********************** Sub programs start *************************************/
SUBMAINPROG
/************************* Error handler ****************************************/
SUBPROG
errhandle
err = 1
// Set error flag to remain in error handler until error is reset.
OUT
8 1
// Set error output
WHILE
err
DO
// Remain in error handler until the reset is received
IF IN
8
THEN
// Reset error when Input 8 is high.
ERRCLR
// Clear error
err=0
// Reset error flag
ENDIF
ENDWHILE
OUT
8 0
// Reset error output
RETURN
/*****************************************************************************/
ENDPROG
/*************************** End of program ************************************/
Содержание MCO 305
Страница 4: ......