How to run tcp slave and serial slave at the same time and share register data 如何同时运行tcp从站和串口从站并共用寄存器数据 #116
-
如何同时运行tcp从站和串口从站并共用寄存器数据 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @qq547176052 , Thank you for a very good question on how to share the register data between two slaves and synchronize the data access between them. For this approach to share the same device memory as registers between the TCP slave instance and the serial slave instance, I can think of several realizations. Each Modbus instance has its own lock ( Approach 1:
Approach 2:
Approach 3:
Let me know if you have any questions related to above functionality. To be updated. |
Beta Was this translation helpful? Give feedback.
Hello @qq547176052 ,
Thank you for a very good question on how to share the register data between two slaves and synchronize the data access between them.
For this approach to share the same device memory as registers between the TCP slave instance and the serial slave instance, I can think of several realizations.
Each Modbus instance has its own lock (
__lock_t
semaphore - mutex object from #include "sys/lock.h" ) sections to protect the data access while mapping. Unfortunately, it is not possible to override this lock mechanism using the existing API.Approach 1:
Create and initialize in the application two instances of slave TCP and slave Serial.
Set up the area descriptors to the …