
MCO 305 Design Guide
__ Functions and Examples __
46
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
POSR
(GET
1900)
// Go to position.
OUT 1 1
// Set "In position" output.
flag = 1
// Set "flag" to ensure that distance is only traveled once.
ELSEIF (IN 1 == 0) AND (flag == 1) THEN
// Stop once when input 1 is low
MOTOR
STOP
// Stop if input is low.
flag = 0
// Reset "flag" to enable new positioning.
GOSUB
engage
// Close mechanical brake after stop.
ENDIF
GOTO MAIN
/********************** Sub programs start ********************************/
SUBMAINPROG
/******************* Engage mechanical brake ******************************/
SUBPROG engage
OUT 11 0
// Close mechanical brake.
DELAY
(GET
1901)
// Wait to ensure that brake is engaged before releasing the motor.
MOTOR
OFF
// Stop position control and coast the motor.
RETURN
/***************** Disengage mechanical brake *****************************/
SUBPROG disengage
MOTOR
ON
// Enable drive and start position control.
DELAY
(GET
1902)
// Wait to ensure that motor is magnetized before opening the brake.
OUT 11 1
// Open mechanical brake.
RETURN
/********************** Error handler *************************************/
SUBPROG errhandle
OUT 11 0
// Close mechanical brake in case of error.
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.
flag = 0
//
Reset "flag" to enable new positioning.
RETURN
/*********************************************************************/
ENDPROG
/************************* End of program *******************************/
Содержание MCO 305
Страница 4: ......