I'd like to know if it is possible to generate a periodic CANopen Heartbeat message, with a 1 second repetition rate, using a NI USB 8473 interface, Labview and usb_canopen_example.llb library.
If any examples are available please point them out, any other suggestions about how I can implement such an application are welcome.
Thanks for contacting us. It may be something that you can setup, but it may take a fair bit of work. Keep in mind that if you are using the 8473, you are not truly using a CANopen device, you are simply using a CAN device that is mimicking some of the basic functionality of CAN.
We aren't aware of any examples doing exactly what you have mentioned. Having said that, the following information may be of some use.
In a CANopen slave device, the index 1017h corresponds to the heartbeat producer time. If you wanted to produce a heartbeat every 1000 ms (1s), you'd write a value of 1000 to that register.
Additionally, the master of the network must be configured to monitor that heartbeat. Therefore, the object dictionay of the master must have a value written to index 1016h. On the master, you additionally need to indicate which node you are monitoring. This is specified in the subindexes of index 1016 for the master - you can have up to 8 subindexes, where each subindex represents a heartbeat being monitored. The subindex is a 32-bit entry, where bit 0-15 is the heartbeat time and bit 16-23 is the node ID monitored. To do all this object dictionary reading and writing, you can use the USB_CANopen functions, the ReadSDO and WriteSDO functions.
Thank you for your answer, however I was curios if PC, as the heartbeat producer can send the Heartbeat message, using Frame API functions in a 1 second event loop running as a separate thead from the main test appplication - that will be implemeted in Testand and Labview. I guess that timing specifications would not be that critical, there are only two nodes on the network, PC and device under test. I still need to understand the Arbitration ID of these messages, and of what type they are (NMT maybe ???).
Sorry about the confusion. You can try to have the CANopen slave node write an SDO to the master node at index 0x700 + node ID (Object Dictionary Indices 0x701 -0x77F are reserved for NMT error control). The data portion of this SDO should represent the node status.