Controlling the Node

Controlling the Node

The CANopen network is organized in a master/slave communication architecture. One single CANopen device (a master or a slave) is represented within the software with a data structure, called "node". This structure is the central entry point of the application into the specific CANopen node.

The following source line is essential to create a new instance of the node:

CO_NODE demo;                    /* create the node instance 'demo' */

The service functions starting with CONode...() are provided for initializing and controlling the node specific aspects. These service functions are requesting the corresponding node pointer as first argument.

For example reading the internal error state of the CANopen Node:

err = CONodeGetErr(&demo);       /* get error state of node 'demo'  */

The same naming convention is realized with several modules. The following table shows the names of the provided modules and their corresponding arguments:


Service GroupArgumentExample
CODir...()&demo.DirCODirFind(&demo.Dir, CO_DEV(0x1234,0x56));
COEmcy...()&demo.EmcyCOEmcyCnt(&demo.Emcy);
COIf...()&demo.IfCOIfSend(&demo.If, &frm);
CONmt...()&demo.NmtCONmtGetMode(&demo.Nmt);
CONode...()&demoCONodeGetErr(&demo);
COTmr...()&demo.TmrCOTmrCreate(&demo.Tmr, 0, 10, MyFunc, 0);
COTPdo...()&demo.TPdoCOTPdoTrigPdo(&demo.TPdo, 1);