K.2.3.3.4 : CM_Guarding(): Heartbeat and guarding mechanism
NETWORK-RUN:
K.8 Error Handling .1 Introduction
K.8.2 Functionalities regarding the emergency-objects in digsy ® compact E / digsy ® CGM
digsy®compact and digsy®CGM feature an integrated error mechanism which can also be used via the application program. In this connection, there are 2 possibilities:
• Reading of an error/a message (emergencies) and entry in the own error memory
• Generation of errors/messages from the application program
K.8.2.1 Basic user-functions regarding the error memory K.8.2.1.1 GetNextError(): Inquiring the error memory
With this function the internal error memory can be read out. Only one error or message is read out at a time. In this connection, the FIFO-principle (first in, first out) applies, which ensures that no entry gets lost.
Function block: GetNextError
1131-Library: Dcompact50x.lib, CGM01_10x.lib; Prosyd.lib Application: in CANopen-manager or in CANopen-slave
Function output Data type Description
Code WORD Error code acc. to „Emergency Error
Code“-classification
Location WORD Error location
Channel DWORD Channel number or address
Para1 WORD Additional parameter 1
Para2 WORD Additional parameter 2
GetNextError Code Location Channel Para1 Para2
04 - 68 280 000/A
Version 1.0.0 Page K-101
K.8.2.1.2 GetNextErrorTS(): Inquiring the error memory with time indication
This function block is an extension of the function block GetNextError(). In addition, the point of time of the occurred error or of the occurred message is output, too.
Function block: GetNextErrorTS
1131-Library: Dcompact50x.lib, CGM01_10x.lib; Prosyd.lib Application: in CANopen-manager or in CANopen-slave
Function output Data type Description
Code WORD Error code acc. to „Emergency Error
Code“-classification
Location WORD Error location
Channel DWORD Channel number or address
Para1 WORD Additional parameter 1
Para2 WORD Additional parameter 2
timestamp DWORD Point of time, i.e., here, the time of the system timer is filed
Example: see Chapter K.8.2.2 „Reading-out an emergency message“
K.8.2.1.3 SetNextError(): Generating an error / a message
In this function block an error or a message is generated from the application program.
This generated message/error is exactly treated like an error generated by the digsy®compact
and the digsy®CGM itself, i.e., it is entered in the internal error memory and, if necessary, output via the CAN-bus.
Function block: SetNextError
1131-Library: Dcompact50x.lib, CGM01_10x.lib; Prosyd.lib; Prosyd42.lib Application: in CANopen-manager or in CANopen-slave
GetNextErrorTS Code Location Channel Para1 Para2 timestamp
04 - 68 280 000/A
Version 1.0.0 Page K-102
Function input Data type Description
Code WORD Error code acc. to „Emergency Error
Code“-classification (see note)
Location WORD Error location
Channel DWORD Channel number or address
Para1 WORD Additional parameter 1
Para2 WORD Additional parameter 2
Example: see Chapter K.8.2.3 „Generating emergency messages“
K.8.2.1.4 Emergency-variables in data structures or of the adjustable control configuration
With the variable en_emergency it is possible for the user to output only certain emergency-messages via the CAN-bus. For this, a mask is placed over the function input or output Code. This is documented in the Chapter K.2.5 „CAN-variables in data structures or in the control configuration“.
Note: There is no difference between an error/a message generated by the system itself and an error/a message generated by the user.
The following classification is applicable:
Number Symbolic name Meaning
0 - No message output
16#01 NO_ERROR Output of messages
16#02 WARNING Output of warnings
16#04 USER_ERROR Output of user error
16#08 APP_ERROR Output of application error
16#10 SYS_ERROR Output of system error
16#1F - Output of all errors/messages
(logic OR-operation of the numbers of this table) Table K.26 Allocation of en_emergency
SetNextError Code
Location Channel Para1 Para2
04 - 68 280 000/A
Version 1.0.0 Page K-103
K.8.2.2 Reading-out an emergency message
The function blocks SetNextError() and SetNextErrorTS() described above are used in order to provide the contents of the internal error memory to the user.
ATTENTION:
Since the internal error memory is a ring buffer, the internal error memory has to be prevented from overflowing by regularly reading out the entries.Appearance of an error memory entry:
The variables Code and Location belonging to the error memory entry define the main selection criteria for the classification of an entry:
Code: Here, a code according to the classification of Table K.25 is deposited. For a detailed description of all possible entries/codes and their respective meanings please refer to the „Manual digsy®CGM“ or the „Manual digsy®CGM“.
Location: This WORD-variable is divided up into 2 bytes which include the following classifications:
• MSB: Classifying the significance according to Table K.26
• LSB: Area where the error / message occurred:
Area designation Area Value
ERR_LOCAT_OS Operating system 1
ERR_LOCAT_1131_LZS 1131-Runtime system (firmware
area) 2
ERR_LOCAT_DIGIN Digital inputs 16#10
ERR_LOCAT_DIGOUT Digital outputs 16#11
ERR_LOCAT_ANIN Analog inputs 16#12
ERR_LOCAT_PWM PWM-outputs 16#13
ERR_LOCAT_ COUNTER Counter 16#14
ERR_LOCAT_ FLASH Flash-ROM 16#15
ERR_LOCAT_ RETAIN Retain data 16#16
ERR_LOCAT_ MEASURE Measurement inputs 16#17
ERR_LOCAT_ HARDWARE Hardware 16#18
ERR_LOCAT_ CANOPEN CANopen 16#19
Table K.27 Locations in DIGSYcompact Example: Location := 16#0212;
Meaning: 16#02xx -> a warning is output
16#xx12 -> the message was generated in the area of the analog inputs
ATTENTION:
As a CANopen-Slave the MSB of the variable Location is changed in a transmission via the CAN-bus:MSB: - 16#80 (external error)
04 - 68 280 000/A
Version 1.0.0 Page K-104
In the case of an implementation as a CANopen-manager the messages or error messages of the individual slaves can thus be unambiguously received and are available for the user. In the variable Channel the node number of the transmitting node is deposited in the „Most-Significant-Word“.
Example: The figure shows the basic sequence for a read-in of the internal error memory in the user error memory ErrorHist:
Figure K.47 Sequence for reading-in the error memory
K.8.2.3 Generating emergency messages
Via the function block SetNextError() it is possible to generate your own messages or error messages. In this connection, the nomenclature of the error coding should correspond with that of the digsy®compact and digsy®CGM, in order to avoid a non-ambiguity of the message. This applies particularly to the variables Code and the MSB of Location.
For user-specifically generated messages/errors the following areas are available for the input variable Code:
04 - 68 280 000/A
Version 1.0.0 Page K-105
Error Code –> Code Comments
16#0000..16#0FFF None
16#6200..16#62FF Partly occupied, please refer to the Chapter Error Coding in the „ digsy®compact“ or „digsy®CGM“ manual
16#FF00..16#FFFF None
Table K.28 Usable Error Codes for the user
Example: With every thousandth call a message will be generated which is entered in the internal error memory and possibly (occupation of en_emergency) transmitted via the CAN-bus:
Figure K.48 Example of generating an error message
04 - 68 280 000/A
Version 1.0.0 Page K-106