11/12/2022 9:43 AM | |
Joined: 3/30/2020 Last visit: 9/27/2025 Posts: 5482 Rating:
|
Using the timer as you say is a viable option. It can be tuned to give results 98% of the time. Simply ignoring the DONE and ERROR states would not be a good and optimal plan. Do note that the DONE and ERROR states are also pulsed for one scan. For that reason that 0_Einstein mentions the Finite State Machine. Consider keeping the storage buffer of MB_Client a general array of BYTEs. Do not attempt to manipulate this array. Only read from it. When the DONE comes up, enter the CASE statement and process the bytes. Use the DESERIALIZE instruction to push the bytes into a UDT structure of your liking. Yes -- I know the Modbus data is in WORDs. But having the 'raw' data in (array of) BYTEs does not matter as it is reprocessed. Besides the DESERIALIZE instruction only works with BYTEs. Now you have more insights as to how communications instructions function. As to avoid further overlap, I will leave you in the hands of expert 0_Einstein. One last thing -- have a look at the following example. It is for Modbus RTU, but the coding structure is of interest to you. SINAMICS V: Speed Control of a V20 with S7-1200 (TIA Portal) via USS® protocol/MODBUS RTU with HMI ~ |
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
This contribution was helpful to
1 thankful Users |
Follow us on