Home

Last modified: 7 January 2002

Using CanoCom.dll

A program must contain a number of steps to be taken when communication with a CANopen network is required. Here follows a summary of these steps.


Opening the network

The opening of the network is done with the function CreateCanOpenNetwork. This function opens a specific CAN-interface at the required baudrate.

Describing the nodes

At this point, there is no knowledge of which communication will take place. To make communication possible, the DLL must be told which kind of CANopen messages it must receive and send. For PDOs and emergency messages this is done by calling DefineEmergencyAndPdoCobs for each node that will use the PDO and emergency services. If SDO communication is also required call ConfigSdoComm for each node that will use SDO communication.
For PDOs and emergency messages that are sent by the nodes, callback functions can be declared with DefineCanOpenMsgCallback. These callback functions will be called when the message specified at DefineCanOpenMsgCallback is received.

Configuration

If SDO communication is defined, the configuration of the nodes can be done with the functions RequestDictionaryObject, for reading of the node's dictionary objects, and WriteDictionaryObject, for writing the node's dictionary objects. SDO communication is a request-reply mechanism; the requests are done by these functions, and the node's replies can be taken from the receive buffer of the DLL by calling GetCanOpenMessage.

Process start

Now that the nodes are configured (or not), the actual process can begin.
If certain nodes use PDO communication, these nodes must be started by sending an NMT start_remote_node command to them by calling SendNmtCommand.
If nodeguarding is required for a node, this can be started by calling StartNodeguarding.

The process

During the process, data is sent and/or received. There are two methods to do this:

The fast method uses PDO communication. Data is sent to nodes by calling SendRxPdo, nodes send their data when certain requirements are met, depending on their configuration. If PDO communication is configured so that a PDO is sent by the node when a remote request is received by the node, this remote request can be sent by calling SendTxPdoRemoteRequest. If a PDO is to be sent by the node on reception of a SYNC pulse, this SYNC can be sent by calling SendCanOpenSync.
When a PDO is received from a node, it will be put in the recive buffer of the DLL, from where it can be taken by calling GetCanOpenMessage, but when a callback function is declared, this callback function will handle the received PDO.

The slow method uses SDO communication, described at the configuration section.

Process end

If the process is about to end, nodeguarding can be stopped by calling StopNodeguarding.
The node(s) can be stopped/reset by sending the proper NMT command to the node(s) by calling SendNmtCommand.

Closing communication

The final thing to do is closing the communication, done by calling CloseCanOpenNetwork.