Thank you Jaroslav, you learn something every day! That will help more than you know with all of my projects. especially ones with process models
Thank you for the detailed reply. This makes sense to me now. Based on what you have said and how I understand it I have moved everything into one task. I forgot about the Modbus driver execution, I was also trying to reduce traffic but it sounds like that is all done for me
What I have now is one task with the below timings. Which is similar to what I would normally be using. A couple of questions though!
Base tick = 20 ms (I have always use 20 ms on RPi and Monarco, I'm not sure if this is good or bad. But I have never had issues)
RPI - Raspberry Pi driver, factor = 1, i.e. execution period = 20 ms
MBM - Modbus RTU master, factor = 5, i.e. execution period = 100 ms
modbus_task, start = 0, stop = 1, factor = 1, i.e. execution period = 200 ms (I use 200 ms most of the time if I have one main task)
The PDF of timing layout makes a lot of sense and I would love to learn more. I am starting to use a lot of process models and think timing could start to be more important for me.
Trying what you suggested has mixed results. I remembered something you showed me awhile ago and looked at the log for just the driver read/write. See below for what the log is saying. This was done with no writing and three registers being read, 0x1000, 0x1010 and 0x1020.
0x1010 seems to return the same value as 0x1000. This shouldn't be the case, 0x1000 is correct though. I changed the read order in the configuration settings and 0x1010 started reading correctly, 0x1000 now does not and returns the same value as 0x1010. It seems hit or miss whether 0x1020 reads the correct value or not, the longer I run the simulation the more chance that 0x1020 reads correctly.
Why would changing the read order have an affect?
Could the CRC errors could also be causing this? The last byte is missing or being cut off. I still receive the correct value though.
3 registers being read (0x1000, 0x1010, 0x1020)
1 register being read (0x2010)
Files enclosed, I will try your suggestions by the end of the day hopefully. I have noticed if I use a larger block (INQUAD or INHEXD) I randomly pick up more registers further down.
This is also the same project I asked about best timing practice, https://forum.rexygen.com/topic/89/project-timing
I'm looking more into execution timing of projects. I'm not sure what I'm asking matters to much but was wondering if there is a best practice/more sensible way of doing things.
What I've done is put two tasks onto "level 0", but have given them different execution factors. The first task runs with an execution factor of 3, the second a factor of 10 as I need both tasks to run at different times. Is this best practice or should the second task be moved to "level 1" and make it so "level 1" runs at my desired timing factor for that task?
For reference. The first task is writing to a slave device via Modbus as a rate of 0.6sec. The second task is reading from the same device via Modbus every 2sec and logging to a TRND block with the same timing factor.
I hope this makes sense!