Download Print this page

Danfoss MCO 305 Design Manual page 81

Hide thumbs Also See for MCO 305:

Advertisement

MCO 305 Design Guide
Tips for Increasing Program Readability
Use of capital and small initial letters (i.e. all commands capital letters, all variables small).
Placement of spacing between command parts.
Place comments in your program. The comments are between
/* ... */ or after //...
/* Begin COMMENT End */ or
// Begin COMMENT End
Inadmissible is: Nesting comments (/* . . . /*. . . */ . . . */)
Use of line identification within the loop.
Command Structure
All instructions consist of: COMMAND WORD + possible Parameter. A variable can also be used as
parameter instead of an absolute number.
Example
POSA 10000
or
pos = 10000
POSA pos
Input Values
As in other programming languages the values inputted are not tested. Thus, it is the programmer's
responsibility to ensure that extreme values do not lead to problems. When searching for such potential
problems use the debug mode.
Error Handling
Possible errors like timeout, position error, or an
emergency stop must be considered and error
handling subroutines must be programmed for
that. Otherwise the program would be aborted
without any possibility to clear the error.
The program sample evaluates an error status by
the error number and defines a subroutine (error
handler), called if an error occurs.
__ How to Program __
ON ERROR GOSUB errhandle
PRINT "Please create a temporary error status"
PRINT " by pushing a limit switch."
endless:
GOTO endless
/**** SUBROUTINE AREA ****/
SUBMAINPROG
ENDPROG
®
MG.33.L4.02 – VLT
is a registered Danfoss trademark
/* Endless loop */
SUBPROG errhandle
/* Evaluate error number and re-set error status */
PRINT "Current error number: ",ERRNO
IF (ERRNO == 25) THEN
/* limit switch or control stop */
PRINT "HW end limit activated"
ELSE
PRINT "It's o.k., although it wasn't a limit switch"
ENDIF
PRINT "You can re-set the cause of the error";
PRINT "within the next 10 seconds"
DELAY 10000
/* Wait 10 seconds */
PRINT "Re-set error status ..."
ERRCLR
/* Re-set error status */
PRINT "... and program terminated."
EXIT
/* program termination */
RETURN
81

Advertisement

loading