Home

Last modified: 8 October 2002

6510 CanoCom.dll API description

for version 3.5.0.0

The API description is also available in the CanoCom.h file.
A description of the things to do when using the DLL can be found here.

Functions

CreateCanOpenNetwork

CloseCanOpenNetwork

SetCanOpenBusBaudrate

AcceptCanOpenMessages

IgnoreCanOpenMessages

DefineEmergencyAndPdoCobs

ConfigSdoComm

UndefineCobs

DefineCanOpenMsgCallback

GetCobId

GetNodeIdCobs

GetCobTypeAndNode

IsCanOpenMsgReceived

GetCanOpenMessage

SendNmtCommand

RequestDictionaryObject

WriteDictionaryObject

StartNodeguarding

StopNodeguarding

SendTxPdoRemoteRequest

SendRxPdo

SendCanOpenSync

SendCanOpenMessage

GetCanCommSettings


Top of page

CreateCanOpenNetwork

Create a CANopen network connection.

CANOPEN_NETWORK CreateCanOpenNetwork(
  IN WORD wCanOpenInterface,
  IN DWORD dwCanBusBaudrate,
  IN const char* lpszInterfaceConfig,
  IN DWORD dwRxBufferSize
);

Parameters

wCanOpenInterface

Specifies the CAN interface

value     meaning
CAN_INTERFACE_6390  Start communication via the 6390 RS232 interface
CAN_INTERFACE_ESD  Start communication via the ESD board interface
CAN_INTERFACE_NICAN  Start communication via a National Instruments NI-CAN interface

dwCanBusBaudrate

Specfies the Baudrate at which the interface must communicate on the CAN bus. Valid Baudrates are: 10, 20, 50, 125, 250, 500 and 1000.

lpszInterfaceConfig:

Pointer to a NULL-terinated string describing the configuration of the CAN Interface. (See the remarks below.)

dwRxBufferSize:

Specifies the number of received CAN messages the FIFO receive buffer can hold.

Remarks

The format of the string lpszInterfaceConfig points to varies with the interface.If the value of wCanInterface is CAN_INTERFACE_6390, the string must be of the following form:

"[serial port name] b:[serial port baudrate]"

The string starts with the name of the serial port to which the 6390 is connected, followed by whitespace and "b:" and ends with the baudrate at which communication between the serial port and the 6390 must take place. So, if the 6390 is connected to COM1 and the baudrate must be 9600, the string will be "COM1 b:9600". Traditionally, the name of serial ports are "COM1", "COM2", "COM3"..., but since hardware manufacturers can call serial port whatever they want, this can be any other name. Valid baudrates are 300, 600, 1200, 2400, 4800, 9600, 19200 and 38400.

If the value of wCanInterface is CAN_INTERFACE_ESD, the string must be of the following form:

"n:[logical net]"

The string starts with "n:" followed by the logical net of the ESD CAN interface the CAN network is connected to. So, if the CAN network is connected to logical net 0, the string will be: "n:0"

If the value of wCanInterface is CAN_INTERFACE_NICAN, the string must be the CAN Network Interface object (e.g. "CAN0", "CAN1" ...) at which the communication must take place. See the documentation of the NI-CAN interface for more information.

Return Values

- If function succeeds, return value is is a CANOPEN_NETWORK variable that can be used at other functions from this DLL.

- If function fails, return value is NULL. To get extended error information, call GetLastError


Top of page

CloseCanOpenNetwork

Close a CANopen network connection.

BOOL CloseCanOpenNetwork(
  IN CANOPEN_NETWORK CanOpenNetwork
);

Parameters

CanOpenNetwork:

The CANopen network connection this function is called for.

Return Values

- If function succeeds, return value is TRUE.

- If function fails, return value is FALSE. To get extended error information, call GetLastError


Top of page

SetCanOpenBusBaudrate

Sets a new CAN-bus Baudrate at the interface of a CANopen network connection. Function does nothing when communicating via NI-CAN.

BOOL SetCanOpenBusBaudrate(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN DWORD dwBaudrate
);

Parameters

CanOpenNetwork:

The CANopen network connection this function is called for.

dwBaudrate:

Specifies a new interface CAN-bus baudrate. Valid baudrates are: 10, 20, 50, 125, 250, 500 and 1000.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

AcceptCanOpenMessages

Tells the DLL to put received messages with the given COB-ID in the received messages buffer of a CANopen network connection.

BOOL AcceptCanOpenMessages(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN WORD wCobId
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

wCobId

min: 0, max: 0x7FF (2047)
specifies a COB-ID of CANopen messages to be put in the buffer.

Remarks

When this function is used to accept messages with the given COB-ID, such a message will yield COB_TYPE_UNKNOWN as the COB type and NODE_ID_UNKNOWN as the node ID by which it was sent, when it is taken from the buffer by GetCanOpenMessage.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. To get extended error information, call GetLastError.


Top of page

IgnoreCanOpenMessages

Tells the DLL to further ignore messages with the given COB-ID at a CANopen network connection.

BOOL IgnoreCanOpenMessages(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN WORD wCobId
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

wCobId

min: 0, max: 0x7FF (2047)
Specifies the ID of the messages that the DLL must ignore. 

Return Values

- If function succeeds, return value is TRUE, and the messages with the given ID will be ignored.

- If function fails, return value is FALSE. To get extended error information, call GetLastError.


Top of page

DefineEmergencyAndPdoCobs

Define one or more COB-ID's as an Emergency or PDO COB of the given node ID. COB types transmitted by the node will be received and stored in the message buffer.

BOOL DefineEmergencyAndPdoCobs(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wCobType,
  IN WORD wCobId
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The node ID that transmits or receives the given COB types.

wCobType

The COB type(s) to define

value    meaning
COB_EMERGENCY Emergency COB, transmitted by node
COB_TX_PDO1 PDO 1 COB, transmitted by node
COB_RX_PDO1 PDO 1 COB, received by node
COB_TX_PDO2 PDO 2 COB, transmitted by node
COB_RX_PDO2 PDO 2 COB, received by node
COB_TX_PDO3 PDO 3 COB, transmitted by node
COB_RX_PDO3 PDO 3 COB, received by node
COB_TX_PDO4 PDO 4 COB, transmitted by node
COB_RX_PDO4 PDO 4 COB, received by node

When the wCobId parameter is DEFAULT_COB_ID, wCobType can be any combination of these values. Otherwise only one of these values can be passed.

wCobId

min 1, max 0x7FF (2047) or DEFAULT_COB_ID
Specifies the COB-ID(s) for the given COB types. Pass DEFAULT_COB_ID to specify the default CANopen COB-ID for the given types of the given node ID.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information


Top of page

ConfigSdoComm

Configures the SDO communication for the given node ID at a CANopen network. This function must proceed calls to RequestDictionaryObject and WriteDictionaryObject for the given node ID.

BOOL ConfigSdoComm(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wTxSdoCobId,
  IN WORD wRxSdoCobId,
  IN DWORD dwMaxDataSize
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Specifies the node ID for which the function is called.

wTxSdoCobId

The COB-ID of the SDOs transmitted by the given node ID. Pass DEFAULT_COB_ID to specify the default CANopen COB-ID for the given node ID.

wRxSdoCobId

The COB-ID of the SDOs received by the given node ID. Pass DEFAULT_COB_ID to specify the default CANopen COB-ID for the given node ID.

dwMaxDataSize

The maximum size in bytes of an object dictionary entry for the given node ID.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

UndefineCobs

Detach COB types and node ID from the COB-ID's previously specified at DefineEmergencyAndPdoCobs or ConfigSdoComm. COB types transmitted by the node will no longer be stored in the message buffer.

BOOL UndefineCobs(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wCobType
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Specifies the node ID for the given COB(s).

wCobType

The COB type(s) to undefine. This can be any combination of the following values

value    meaning
COB_EMERGENCY    Emergency COB, transmitted by node
COB_TX_PDO1    PDO 1 COB, transmitted by node
COB_RX_PDO1    PDO 1 COB, received by node
COB_TX_PDO2    PDO 2 COB, transmitted by node
COB_RX_PDO2    PDO 2 COB, received by node
COB_TX_PDO3    PDO 3 COB, transmitted by node
COB_RX_PDO3    PDO 3 COB, received by node
COB_TX_PDO4    PDO 4 COB, transmitted by node
COB_RX_PDO4    PDO 4 COB, received by node
COB_TX_SDO    SDO COB, transmitted by node
COB_RX_SDO    SDO COB, received by node

When COB_TX_SDO and/or COB_RX_SDO is specified, calls to RequestDictionaryObject and WriteDictionaryObject are no longer possible for the given node ID.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

DefineCanOpenMsgCallback

Defines that the function pointed to by pCallback must be called when a message of the wCobType COB type is received from the node ID bNodeId.

BOOL DefineCanOpenMsgCallback(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wCobType,
  IN LPCANOPENMSG_CALLBACK lpCallback,
  IN LPVOID lpCallbackParam
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The Node ID that must send the messages of the COB type defined at wCobType.

wCobType

The COB type of the messages the node ID at bNodeId must send for the function to be called.

value     meaning
COB_EMERGENCY     Emergency COB, transmitted by node
COB_TX_PDO1     PDO 1 COB, transmitted by node
COB_TX_PDO2     PDO 2 COB, transmitted by node
COB_TX_PDO3     PDO 3 COB, transmitted by node
COB_TX_PDO4     PDO 4 COB, transmitted by node
COB_NODEGUARD     Nodeguarding COB

pCallback

Pointer to the application-defined function that must be called when a message of the type defined at wCobType is received from the node ID defined at bNodeId. The function must be of the type Pointer to the application-defined function of type LPCANOPENMSG_CALLBACK.

lpCallbackParam

Specifies a single 32-bit parameter value passed to the callback function.

Remarks

LPCANOPENMSG_CALLBACK
The callback function must have the following form
LRESULT CALLBACK MessageReceivedCallback(
  IN BYTE bNodeId,
  IN WORD wCobType,
  IN WORD wCobId,
  IN BYTE bDataLen,
  IN const BYTE* const pbData,
  IN void* lpCallbackParam
)

Parameters

bNodeId

The node ID that sent the message.

wCobType

The type of the message.

wCobId

The message ID of the message.

bDataLen

The number of data bytes the message contains.

bData

The buffer containing the data of the message.

lpCallbackParam

The value of lpCallbackParam defined at DefineCanopenMsgCallback

If the callback function is defined for nodeguarding, the callback will only be called when a nodeguarding error occurs (i.e. node in wrong operational state or no answer from the node).

The value returned by the callback function must be non-zero when the callback function is no longer to be called for the node ID, zero otherwise. If the callback is defined for nodeguarding, this is of no importance, since the callback is called when a nodeguarding error occurs, and such an error will stop nodeguarding for the node.

Return Values

-DefineCanOpenMsgCallback returns TRUE on success, FALSE on failure. Call GetLastError to get extended error information.


Top of page

GetCobId

Retreives the COB-ID that is defined as a certain COB type of the given node ID at earlier calls to DefineEmergencyAndPdoCobs, ConfigSdoComm or StartNodeguarding.

WORD GetCobId(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wCobType
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The node ID.

wCobType

The COB type. This must be one of the following values

value     meaning
COB_EMERGENCY     Emergency COB, transmitted by node
COB_TX_PDO1     PDO 1 COB, transmitted by node
COB_RX_PDO1     PDO 1 COB, received by node
COB_TX_PDO2     PDO 2 COB, transmitted by node
COB_RX_PDO2     PDO 2 COB, received by node
COB_TX_PDO3     PDO 3 COB, transmitted by node
COB_RX_PDO3     PDO 3 COB, received by node
COB_TX_PDO4     PDO 4 COB, transmitted by node
COB_RX_PDO4     PDO 4 COB, received by node
COB_TX_SDO     SDO COB, transmitted by node
COB_RX_SDO     SDO COB, received by node
COB_NODEGUARD     Nodeguarding COB

Return Values

- Function returns the COB-ID that is defined as the given COB type of the given node ID. When the COB is not yet defined, function returns COB_ID_NONE.

- Function returns 0 on failure. Call GetLastError to get extended error information.


Top of page

GetNodeIdCobs

Get the COB's that are defined for a node ID at previous calls to DefineEmergencyAndPdoCobs, ConfigSdoComm, or StartNodeguarding.

WORD GetNodeIdCobs(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The node ID that the COB's have been defined for.

Return Values

- Function returns a bitmask containing the COB types that have been defined for the given node ID, zero when no COB's have been defined.


Top of page

GetCobTypeAndNode

Determine how a COB-ID is defined at previous calls to AcceptCanOpenMessages, DefineEmergencyAndPdoCobs, ConfigSdoComm, or StartNodeguarding.

BOOL GetCobTypeAndNode(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN WORD wCobId,
  OUT BYTE* pbNodeId,
  OUT WORD* pwCobType
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

wCobId

The COB-ID wherefrom the COB type and node ID must be determined.

pbNodeId

Pointer to a BYTE variable that will receive the node ID attached to the given COB-ID. Will receive NODE_ID_NONE if the COB-ID is not yet defined.

pwCobType

Pointer to a WORD variable that will receive the COB type attached to the given COB-ID. Will receive COB_TYPE_NONE if the COB-ID is not yet defined.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

IsCanOpenMsgReceived

Retreive number of messages in message buffer, and get information on the next message that can be taken from the message buffer. If buffer is empty, wait for a message to be put in the buffer.

LONG IsCanOpenMsgReceived(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN DWORD dwMilliseconds,
  OUT WORD* pwCobType,
  OUT BYTE* pbNodeId,
  OUT WORD* pwCobId,
  OUT DWORD* pdwDataLength
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

dwMilliseconds

Specifies the time-out interval, in milliseconds. When no messages are in the message buffer at the time of calling, the function waits until the specified time-out has passed or if a message was received before it has passed. If dwMilliseconds is zero, the function checks the buffer's state and returns immediately. If dwMilliseconds is INFINITE, the function's time-out interval never elapses. 

pwCobType

Pointer to a WORD variable that will receive the COB type of the next message to be taken from the message buffer, or NULL.

pbNodeId

Pointer to a BYTE variable that will receive the node ID that sent the next message to be taken from the message buffer, or NULL.

pwCobId

Pointer to a WORD variable that will receive the COB-ID of the next message to be taken from the message buffer, or NULL.

pdwDataLength

Pointer to a DWORD variable that will receive the length, in bytes, of the next message to be taken from the message buffer, or NULL.

Return Values

- Function returns the number of messages in the buffer, zero if the buffer is empty and no messages were received during the time-out.

- Function returns -1 on failure. Call GetLastError to get extended error information.


Top of page

GetCanOpenMessage

Get the next message from the message buffer. If buffer is empty, wait for a message to be put in the buffer.

CHAR GetCanOpenMessage(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN DWORD dwMilliseconds,
  OUT WORD* pwCobType,
  OUT BYTE* pbNodeId,
  OUT WORD* pwCobId,
  OUT DWORD* pdwDataLength,
  OUT void* pvData,
  OUT DWORD* pdwNumOfRemainingMsg
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

dwMilliseconds

Specifies the time-out interval, in milliseconds. When no messages are in the buffer at the time of calling, the function waits until the specified time-out has passed or if a message was received before it has passed. If dwMilliseconds is zero, the function returns immediately. If dwMilliseconds is INFINITE, the function's time-out interval never elapses.

pwCobType

Pointer to a WORD varaible that receives the COB type of the message taken from the message buffer, or NULL. See the remarks below for more information.

pbNodeId

Pointer to a BYTE variable that receives the node ID that sent the message taken from the message buffer, or NULL.

pdwDataLength

Pointer to a DWORD varaible that receives the length, in bytes, of the message's data taken from the message buffer, or NULL.

pvData

Pointer to the buffer that will receive the message's data taken from the message buffer. 

pdwNumOfRemainingMsg

Pointer to a DWORD variable that receives the number of message left in the message buffer, or NULL.

Remarks

When the COB type of the message is COB_TX_SDO, the data is formatted as below

When the COB type of the received message is COB_NODEGUARD, a nodeguarding error has occurred for the node ID returned in pbNodeId, and nodeguarding is stopped for that node. When the one byte of the message's data is zero, the node did not respond on a nodeguarding request. When this byte is non-zero, the node's operational state changed to another state than specified at StartNodeguarding.

The other COB types remain unchanged when they are received and put in the message buffer.

Return Values

- Function returns 1 if a message is taken from the buffer before the specified time-out has passed.

- Function returns 0 if no message could be taken from the buffer before the time-out has passed.

- Function returns -1 on failure. Call GetLastError to get extended error information.


Top of page

FlushCanOpenBuffer

Clear the message buffer.

BOOL FlushCanOpenBuffer(
  IN CANOPEN_NETWORK CanOpenNetwork
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

SendNmtCommand

Send a NMT command to a node or to all nodes on the CAN network.

BOOL SendNmtCommand(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeIdIN BYTE bNmtCommand
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Node ID to send the command to, or zero to select al node ID's on the connected CAN network.

bNmtCommand

The NMT command to send. This must be one of the following

value     meaning
NMT_START_REMOTE_NODE     set node in operational state
NMT_STOP_REMOTE_NODE     set node in prepared state
NMT_ENTER_PRE_OPERATIONAL_STATE     set node in pre-operational state
NMT_RESET_NODE     reset the node
NMT_RESET_COMMUNICATION     reset the node's communication 

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

RequestDictionaryObject

Request the data of a dictionary object of the given node ID. Response will be put in the message buffer from where it can be taken by GetCanOpenMessage. This function must be proceeded by a call to ConfigSdoComm with the given node ID.

BOOL RequestDictionaryObject(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wObjectIndex,
  IN BYTE bObjectSubindex
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Specifies the node ID of which an object must be read.

wObjectIndex

The object's index.

bObjectSubindex

The object's subindex.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

WriteDictionaryObject

Write data to a dictionary object of the given node ID. Response will be put in the message buffer from where it can be taken by GetCanOpenMessage. This function must be proceeded by a call to ConfigSdoComm with the given node ID.

BOOL WriteDictionaryObject(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wObjectIndex,
  IN BYTE bObjectSubIndex,
  IN DWORD dwDataLen,
  IN const void* pvData
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Specifies the node ID of which an object must be written.

wObjectIndex

The object's index.

bObjectSubindex

The object's subindex.

dwDataLen

The size in bytes of the data to write.

pvData

Pointer to a buffer containing the data to write to the object.  The data must be in little endian format (LSB first) for numeric data.

Return Values

- Function returns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

StartNodeguarding

Start nodeguarding for the given node ID. Nodeguarding requests will be done every wGuardTime milliseconds. When no response is received, a message of  the type COB_NODEGUARD and a null char as data will be put in the message buffer. If the node is in a different state than bExpectedState, nodeguarding will be stopped and the last received nodeguarding response will be put in the buffer.

BOOL StartNodeguarding(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN WORD wCobId,
  IN WORD wGuardTime,
  IN BYTE bExpectedState
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Node ID to start nodeguarding for.

wCobId

The COB-ID at which nodeguarding requests and responses take place. Specify DEFAULT_COB_ID to use the default CANopen nodeguarding COB-ID for this node.

wGuardTime

Specifies the millisecond interval at which the nodeguarding requests are sent to the given node ID.

bExpectedState

Determines in which state the node is expected to be. This must be one of the following

value     meaning
NODE_PRE_OPERATIONAL     Node must be in pre-operational state
NODE_PREPARED     Node must be in prepared state
NODE_OPERATIONAL     Node must be in operational state
NODE_ANY_STATE     Node must respond

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

StopNodeguarding

Stop nodeguarding for the given node ID.

BOOL StopNodeguarding(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

Node ID for which the nodeguarding must be ended.

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

SendTxPdoRemoteRequest

Send a remote request for a PDO previously defined at DefineEmergencyAndPdoCobs.

BOOL SendTxPdoRemoteRequest(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN BYTE bTxPdoNumber
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The node ID to send the request to.

bTxPdoNumber

The requested transmit PDO (1, 2, 3 or 4).

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

SendRxPdo

Send a PDO previously defined at DefineEmergencyAndPdoCobs to a node ID.

BOOL SendRxPdo(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN BYTE bNodeId,
  IN BYTE bRxPdoNumber,
  IN BYTE bDataLength,
  IN const void* pvData
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

bNodeId

The node ID to send the PDO to.

bRxPdoNumber

The number of the receive PDO (1, 2, 3 or 4).

bDataLength

The number of data bytes to send (1..8).

pvData

Pointer to a buffer containing the data to send, numeric data in little endian format (LSB first).

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

SendCanOpenSync

Send a SYNC pulse over the CAN bus (COB-ID 128).

BOOL SendCanOpenSync(
  IN CANOPEN_NETWORK CanOpenNetwork
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

SendCanOpenMessage

Send a message

BOOL SendCanOpenMessage(
  IN CANOPEN_NETWORK CanOpenNetwork,
  IN WORD wCobId,
  IN BOOL fRtr,
  IN BYTE bLen,
  IN const void* pvData
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

wCobId

The COB-ID of the message to send.

fRtr

The Remote Transmit Request flag of the message to send.

bLen

The number of bytes to send (1..8).

pvData

Pointer to a buffer containing the data to send.

Return Values

- Function retunrns TRUE on success.

- Function returns FALSE on failure. Call GetLastError to get extended error information.


Top of page

GetCanCommSettings

Get information on the CANopen communication settings.

WORD GetCanoComSettings(
  IN CANOPEN_NETWORK CanOpenNetwork,
  OUT char* pszInterfaceConfig,
  OUT DWORD* pdwCanBusBaudrate,
  OUT DWORD* pdwBufferSize
);

Parameters

CanOpenNetwork

The CANopen network connection this function is called for.

pszInterfaceConfig

Pointer to the location that will receive the interface configuration string as it is passed to CreateCanOpenNetwork, or NULL.

pdwCanBusBaudrate

Pointer to a DWORD variable that will receive the CAN bus Baudrate at the interface, or NULL.

pdwBufferSize

Pointer to a DWORD variable that will receive the size of the received messages buffer in number of CAN messages, or NULL.

Return Values

- Function returns the interface that is used for communication (CAN_INTERFACE_6390, CAN_INTERFACE_ESD or CAN_INTERFACE_NICAN), zero on error. To get extended error information, call GetLastError.