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

Modbus Serial as easy as...

williamc
2013-12-23
2015-07-03
  • williamc - 2013-12-23

    Hi,

    I'm a bit stuck.

    I've got a device which runs CoDeSys and has a serial port present.

    In my application I've added a Modbus Com device and then under this a Modbus serial standalone slave device.

    I've set my coms port to the physical port of the device and the device to ID 1 and then mapped my input parameter to a variable in my program.

    Then I use an application to send a modbus message to device id 1, code 6, address 0 and value 1.

    But I don't receive the value in my program.

    Where am I going wrong?

    Any help greatfully received.

    One additional note...this isn't probably helping.

    When I run program and look at my Modbus_Com Status I have PCI-Bus : No driver found error. What does this mean?

     
  • AndreyS - 2013-12-24

    Is "No driver found" displayed in STOP state of program?
    Is it changed to "Bus failure" when you start the program?
    The one possible reason can be that you have wrong settings in "Modbus serial port configuration". Usually this causes wrong COM port number.
    The other possible reason can be that the PLC vendor does not support SysCom library in the runtime. But this is pretty unlikely. What PLC do you use?

     
  • williamc - 2013-12-24

    The driver state stays the same when running or stopped.

    The only way I've managed to configure that doesn't show this error is to add a master then a slave but this isn't the physical attributes of the device.
    I can't really speak about the device as it is something that is under development however, I have been assured that the Modbus comms should just work. I've been told there are two physical ports on the unit one for debug and one for field bus. But I have tried setting com port to both 1 and 2 and they show same error.

     
  • AndreyS - 2013-12-24

    williamc hat geschrieben:
    The driver state stays the same when running or stopped.
    The only way I've managed to configure that doesn't show this error is to add a master then a slave but this isn't the physical attributes of the device.
    I can't really speak about the device as it is something that is under development however, I have been assured that the Modbus comms should just work. I've been told there are two physical ports on the unit one for debug and one for field bus. But I have tried setting com port to both 1 and 2 and they show same error.

    Do you use Linux as a base platform for your device? Can you look at CODESYS startup log on your device? SysCom could print some debug message to stdout.

     
  • williamc - 2013-12-24

    I think it's vxworks based.

    What is meant by PCI-Bus anyway?

     
  • AndreyS - 2013-12-24

    williamc hat geschrieben:
    I think it's vxworks based.
    What is meant by PCI-Bus anyway?

    I am not sure, what PCI actually means. Maybe something like peripheral communication (component) interface. But it does not have nothing common with the PCI bus from desktop computers. =). This is just a virtual bus for connecting components. This connector is be placed to an error state by the driver, that handels it. This driver use SysCom library.

    Try to use SysCom functions directly and to look at CODESYS messages on the debug console.

     
  • williamc - 2013-12-24

    OK - I'll give that a go and see what happens. Thanks.

     
  • Danybba - 2015-07-03

    Hy, I have the same Problem:

    First question is ist possible to use teh Raspberry with Codesys as a Modbus RTU Slave Device?

    If yes I implemented the Modbus Com Port and added the Modbus Serial Device. I also added the .cfg code to COMPORT1. But Codesys always says "no driver found" in the State of the comport and the serial device.

    Can you please help me?

    Regards Daniel

     

Log in to post a comment.