Connecting/communicating with a Modbus device

  • Hi,

    Me again; things are working out great and I'm very happy with the Unipi Neuron, so I keep on exploring more about it's functionality (and that of Codesys).

    Next challenge, connect/communicate with a Modbus device. I'm trying to connect a CO2 sensor, which allows Modbus communication (I can also use analog output, but I have to connect multiple and then Modbus seems like a good solution).

    Can someone point me in the right direction?

    This is the datasheet/manual of the sensor: Manual

    • Setting: Baudrate: 19200 // Stopbit: One // Parity: Even // Address: to be decided (5 dip-switches to set)

    Modbus Map
    0_1526113024777_Screen Shot 2018-05-12 at 10.16.38.png

    I've already added the Modbus_COM and Modbus_Serial_Device, but no I have no idea on how to make the "link" with the Modbus Map.
    0_1526113836423_Modbus_Serial_Devices.PNG 0_1526113848028_Modbus_com.PNG

    Eternal thanks for all your help :)

  • administrators

    Hi Oliver,

    There is an example of using serial modbus in the Neuron demo application.

    Please also have a look at the data sheet regarding installation and serial ports. To be able to use the serial port on a Neuron from CODESYS a one time configuration change is required. If you run the demo application it will make the required change, the data sheet includes details on functions that can be used to configure the serial port.

    Please ask if you need more help with this.

  • OK, so I successfully ran the demo on the Unipi, so that means the the configuration is done? I can just leave the RS485 on "disabled? I don't need to include anything in my program for the RS485 to be "enabled", besides of course the added modbus device.

    As there are 2 ports, A and B, do I need to make any specific changes when adding a "device"? Or is it enough the set the address on the slave device and Codesys?

    And I found the proper way to add the registers, so I'll give it a try tomorrow.

  • administrators

    Hi Oliver,

    You need a modbus com device for each port you wish to use. Then under those a modbus master device, and then a modbus slave for each slave connected to that port.

    The modbus com port needs to be set to com 1 for the first port, 2 for the second..,

    So if your slave devices operate with the same serial port settings you could use different modbus addresses for each and connect them to the same port, or put one on each port.

Log in to reply

Looks like your connection to Forum was lost, please wait while we try to reconnect.