
MCO 305 Design Guide
__ Functions and Examples __
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
29
SYNCP
// Start position synchronizing mode
old_offset = GET SYNCPOSOFFS
WHILE (IN 1 == 1) DO
// Stay in synchronizing mode while input 1 = 1
IF (IN 4 == 1) THEN
GOSUB
increase_offset
ELSEIF (IN 5 == 1) THEN
GOSUB
decrease_offset
ENDIF
IF (SYNCSTAT & 4) THEN
OUT
1
1
ELSE
OUT
1
0
ENDIF
ENDWHILE
MOTOR
STOP
// Stop if input 1 is low.
home_done
=
0
// Reset home_done flag after stop
OUT 1 0
OUT 2 0
// Reset home done output after stop
IF (new_offset != old_offset) AND (GET 132 == 0) THEN
// Save absolute offset if changed
SAVE
AXPARS
// NOTE: Saving more that 10000 times can damage flash PROM
ENDIF
ENDIF
GOTO MAIN
/*************************** Sub programs start *********************************/
SUBMAINPROG
/***************************** Increase offset **********************************/
SUBPROG increase_offset
IF (Next_step) THEN
// Check if next offset step is enabled
IF (GET 1901 == 0) THEN
// Absolute offset
new_offset = old_ GET 1900
// Read existing offset and add step value
SET
SYNCPOSOFFS
new_offset
// Set new position offset
ELSE
// Relative offset
MOVESYNCORIGIN
GET
1900
// Execute relative offset with offset step
ENDIF
ENDIF
Next_step=0
// Disable next offset step
ON TIME 500 GOSUB Enb_Step
// Enable next offset step after 500 ms
RETURN
/*************************** Decrease offset ***********************************/
SUBPROG decrease_offset
IF (Next_step) THEN
// Check if next offset step is enabled
IF (GET 1901 == 0) THEN
// Absolute offset
new_offset = GET SYNCPOSOFFS - GET 1900
// Read existing offset and subtract step value
SET
SYNCPOSOFFS
new_offset
// Set new position offset
ELSE
// Relative offset
MOVESYNCORIGIN
(-
GET
1900)
// Execute relative offset with - offset step
ENDIF
ENDIF
Next_step=0
// Disable next offset step
ON TIME 500 GOSUB Enb_Step
// Enable next offset step after 500 ms
RETURN
/************************* Enable new offset step *******************************/
Summary of Contents for MCO 305
Page 4: ......