User-defined error output (#ERROR)
The NC command #ERROR allows the output of user-defined error messages which are further processed by the higher-level GUI (GUI = Graphical User Interface). Additional parameters offer the option of specifying the error more precisely.
The error number (ID) and error message are assigned in a user-defined file (FCT-M7// Outputting user error messages). The memory location (path) and filename are entered in the parameter P-STUP-00169.
Syntax |
#ERROR [ [ID=..] [RC=..] [MID=..] {PV<i>=..} {PM<i>=..} {PIV<i>=..} ] |
ID=.. | Error number: 1...1000: The numerical value determines the user-specific error number to be output. |
RC=.. | Error remedy class: 0: Warning, no transition to error state. Program execution is continued. 2: Error, transition to error state. Can be cleared with NC–RESET. 7: Fatal error, transition to ‘system error’ state. Requires controller restart. |
MID=.. | Multiple ID. Counter acts as a distinguishing feature if the #ERROR command with the same error number (ID) is used several times in an NC program. MID must be a positive integer. |
PV<i>=.. | Max. 5 (1 <= i <= 5) user-specific numerical values (PV1...PV5) in real format can also be output in the error message. As of V3.1.3080.14 and V3.1.3107.48, strings can also be output, e.g.. PV1=“Test“. |
PM<i>=.. | The maximum of 5 (1 <= i <= 5) PM parameters (PM1...PM5) specify the meaning of the PV parameters more precisely. 0: IGNORE, value has no meaning 1: Limit value 2: Current value 3: Error value 4: Expected value 5: Corrected value 6: Logical axis number 7: Drive type 8: Logical control element number 9: State 10: Transition 11: Sender 12: Class 13: Instance 14: Identification number 15: State 16: Ring number 17: Block number 18: Lower limit value 19: Upper limit value 20: Initial value 21: Final value |
PIV<i>=.. | The maximum of 4 (1 <= i <= 4) PIV parameters (PIV1...PIV4) transfer additional information in real format. |
For non-programmed parameters, the following default values are valid:
ID | 1 |
RC | 0 |
MID | 0 |
PV1...PV5 | 0.0 |
PM1…PM5 | 1 |
PIV1...PIV4 | 0.0 |
Programing Example
User-defined error output
; -------
; Output of warning with ID 100, multiple identifier 10
#ERROR [ID100 RC0 MID10]
; ..
; -------
; Output of warning with ID 455 with parameter
; Error 455 with parameters
; Parameter 1 – current value is 1
; Parameter 2 – incorrect value is 4.999
#ERROR [ID455 RC2 PV1=5 PV2=4.999 PM1=2 PM2=3]
; ..
; Error output with string as of V3.1.3080.14
; Expected value Text A
; Incorrect value Text B
#ERROR [ID123 RC2 PV1="Text-A" PM1=4 PV2="Text-B" PM2=3]
;…
; -------
; Fatal error 999
#ERROR [ID999 RC7]