elsmart - 2025-05-16

Hello

I need some help understanding how to use Modbus RTU (COM port) in Codesys enviroment. I defined a Modbus Server device (slave) in device tree and added some channels to read from (function 3). Also I set trigering mode to Application. I have a POU in which I want to trigger each channel one after the other something like this (C code for better visualisation):

for (int i = 0; i < channelsCount; i++) {

    triggerChannel(channelsArray[i]); // Start transmission
    while(channel.xBusy); // Wait for transmission to complete

}

I have found ModbusChannel function block documentation but examples are scarce. I don't understand how rising edge triggering works. What would be the best solution for achieving sequntial channel triggering? What is the common way to read multiple Modbus channels once every time a specified POU is executed?