Parker Hannifin
REM --------- Print error out comm1 to terminal ---------
IF (ErrorOccurred)
REM Print time since controller power on or reset
GOSUB CheckTime
IF (MEIErrorCode > 0)
PRINT #1, "MEI Error ";MEIErrorCode;" -> ";$V0
REM Motion Enable Input status
ENDIF
IF (CANopenErrorCode > 0)
PRINT #1, "CANopen Error ";CANopenErrorCode;" -> ";$V1
REM CANopen status
ENDIF
IF (XErrorCode > 0)
PRINT #1, "Axis 0 Error ";XErrorCode;" -> ";$V2 : REM Axis 0
REM status
ENDIF
IF (YErrorCode > 0)
PRINT #1, "Axis 1 Error ";YErrorCode;" -> ";$V3 : REM Axis 1
REM status
ENDIF
PRINT #1, "" : REM print a blank line between error messages
REM error codes must be cleared by HMI or by this program
IF (ClearErrorCodes) : REM set Axis ClearErrorCodes to have
REM program clear codes automatically
XErrorCode = 0
YErrorCode = 0
ENDIF
CLR ErrorOccurred
ENDIF
GOTO LoopStart
_CheckTime
REM This implements a "clock" for showing time since power up or
REM reboot, assuming P6916 is not set by user. P6916 resets to zero
REM at 2**31 (2^31). P6916 is a free-running clock in milliseconds
Time = P6916 : REM capture current time in ms.
REM extract the millisecond portion
ms = Time MOD 1000 : REM extract any ms less than 1 full second
REM extract the second portion
REM remove ms from the Time and convert time to seconds
seconds = (Time - ms)/1000
ExcSeconds = seconds MOD 60 : REM extract any seconds less than a
REM full minute
REM extract the minute portion
REM remove seconds from the Time and convert time to minutes
minutes = (seconds - ExcSeconds) / 60
REM extract any minutes less than a full hour
Error Handling 165