CANopen Manager / Slave Manual - esd electronics, Inc.
CANopen Manager / Slave Manual - esd electronics, Inc.
CANopen Manager / Slave Manual - esd electronics, Inc.
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>CANopen</strong>-<strong>Slave</strong><br />
The node event handler that is defined in canOpenCreateNodeEx() is called every time the <strong>CANopen</strong><br />
slave has to indicate an event or error to the application. The application can define an event mask with<br />
events that are to be indicated using the parameter ulEventMask of the structure SLAVE_NODE_INFO<br />
which is a parameter of canOpenCreateNodeEx().<br />
The event handler itself has to follow the syntax:<br />
int EventHandler(SLAVE_EVENT *pEvent);<br />
The handler should always return SCANOPEN_OK and shouldn’t block. The argument of the event<br />
handler is a pointer to the following structure:<br />
typedef struct {<br />
unsigned short usNetNo;<br />
unsigned short usModId;<br />
unsigned long ulEvent;<br />
unsigned long ulArg1;<br />
union {<br />
unsigned long ulArg2;<br />
void * pArg2;<br />
} arg;<br />
} SLAVE_EVENT;<br />
The member variable usNetNo and usModId describe the logical net number and the local slave Node-<br />
ID of the event source, so a common event handler might be used for all local slaves on all configured<br />
networks. The member variable ulEvent is the event type. The event types are the same that are used<br />
to define the event mask in the structure SLAVE_NODE_INFO mentioned above. The argument ulArg1<br />
is the first subargument of the event type. The second subargument is either another decimal or a<br />
pointer to a data structure whose type depends on the main event type.<br />
The following table summarizes the possible event types with their subarguments.<br />
ulEvent ulArg1 ulArg2/pArg2 Event reason<br />
EV_GUARDING EV_START --- Node/Lifeguarding is started<br />
EV_TIMEOUT --- Lifeguarding timed out<br />
EV_STOP --- Node/Lifeguarding is stopped<br />
EV_STATE_CHANGE state --- node has changed into state<br />
EV_RESET<br />
EV_COMMUNICATION EV_BEGIN Enter Reset Communication state<br />
EV_COMMUNICATION EV_END Leave Reset Communication state<br />
EV_APPLICATION EV_BEGIN<br />
EV_APPLICATION EV_BEGIN<br />
Enter Reset Application started state<br />
Leave Reset Application state<br />
EV_CONFIGURATION EV_STORE - Store configuration request<br />
EV_RESTORE - Restore configuration request<br />
<strong>CANopen</strong> <strong>Slave</strong> Software <strong>Manual</strong> • Doc. No.: C.2002.21 / Rev. 2.2 Page 49 of 65