francoinf - 2020-09-16

Good morning,
I am creating an application in which I have to read the variation of a digital signal, through modbus rtu, with a frequency that varies from 1 Hz to 15 Hz, but unfortunately the speed of
response within codesys is very slow (I can capture a maximum variation of 2 Hz; above this value, I cannot capture the variations).
Below I describe what I did: the digital signal read by the modbus controls an event task (every time the digital signal passes from 0 to 1, the event that enables
the task). The task activates a routine that increments the counter by one unit (in this way I can count the number of rising edges in a given time interval).
When the frequency of the digital signal does not exceed 2 Hz, I can perform this count, otherwise not (the variation of a fast signal is not captured).
From the outside I see that the signal varies correctly, but codesys does not detect it.
I used:
- a baud rate of 115200 (I started from 9600 up to 115200, without getting any improvements);
- the master bus cycle task is controlled by a 50 ms cyclic task (I have changed this interval, without obtaining better results);
- the trigger of the modbus channel for reading the digital signal is cyclic, and set at 50 ms (I have changed this interval, without obtaining better results);

With a modbus testing software, on the other hand, I am able to instantly capture the variation of the digital signal; it is within codesys that I can't.

Can anyone help me?
Thanks in advance