C# events to read the data from Modbus TCP RRS feed

  • Question

  • Hello All:

    I am working on implementing Modbus TCP to connect to mulitple modbus TCP devices. I've implemented Modbus TCP client which works fine with one device reading a requested data from single hodling registers at a time. I am raising an event whenever there is a new data from modbus and processing that data. Below is what I have to implement:

    1. Each device as different data at different holding registers: For example. System Status is at register 13. Courrent Count  at 15 and so.:

       - WHat is the best way to read these two data simultaneously or parallely? How can I use threads and events?. I could use polling, but it would be too much delay to read more data residing at different registers.

    2. How can I connect to mutiple devices and perform the same function explained above? What is the best way? I am new to C#. Any guidance would be appreciated. Happy to discuss in detail if required.



    • Moved by Fei Hu Thursday, April 19, 2018 2:12 AM Moved From C#
    Tuesday, April 3, 2018 1:26 PM

All replies

  • Unfortunately we're not going to be much help here. What you're asking for is proprietary to Modbus and requires an extensive amount of code. I would strongly recommend that you take a look at the third party library OPC.NET which is designed to talk to PLCs via OPC and is available for .NET. It provides the necessary infrastructure to poll the data like you ask and has some requirements about how you do it.

    You'll need to post questions related to it in their forums however. We can only help you with C#-specific questions.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, April 3, 2018 1:48 PM