Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Only Listen to existing CANopen System

Daltech
2019-11-25
2019-12-06
  • Daltech - 2019-11-25

    Hello there,

    I'd really love to hear your opinion on the following problem.
    We have a working CANopen System, it has a Master and several (other) Nodes.
    There is a port which I can use to physically connect to the CAN-Bus.
    Now, I want the Data of specific PDOs to be transferred to variables in the CODESYS programm. The PDOs are sent peridodically, so our PLC is just supposed to listen to commands that are sent on the Bus.

    How can I create a programm, that let's our PLC act only as a CAN-Bus listening device?

    It's crucial that it does not interfere with the existing system! I've made the mistake to initiate our PLC as a Master and added the existing nodes to it, which resultet in me overwriting existing parameters. That led to the system not working for a good amout of time and my bloodpressure rising above healthy levels, since that system is quite expensive

    What will probably work is setting up our PLC as a slave containging only the desired rPDOs, but then it'll have to answer to heartbeats and stuff, which I want to avoid, since it loads the Bus unnecessarily.

    Thanks for your help, really appreciate it!

     
  • DavidBo - 2019-12-06

    When you edit your CAN bus device in codesys, you can set op PDOs but there is also an entry called CANbus I/O mapping for the device.
    Here you can map specific PDO variables to your own application-specific variables. But please remember to enable the update of the variables every cycle or so. So as long as you don't write anything and as long the devices are in operational state you will just be reading these variables.
    You write that you don't want to interact with the device. That is not fully avoidable. For instance, when you configure the PDO you actually modify the initialization of the device. After all, the device will have to know what to send in the PDOs. In fact, quite a lot goes on during the initialization of the devices.
    The CANopen manager can easily be configured to producing a heartbeat and if none of the device-node for some reason also is a heartbeat producer it would work right out of the box.

     
  • Lo5tNet - 2019-12-06

    Hey @Daltech,
    In the past I have used this project to help accomplish this. https://store.codesys.com/can-bus-example.html?___store=en

    This allows you to easily listen for those messages and process them how you would like to. I don't know how you could do it using the CANopen device manager.

     

Log in to post a comment.