Modicon PAC Forum
A forum for topics related to the scope of Modicon PAC offers and ecosystem along the whole lifecycle: Modicon M580 and 340, EcoStruxure Control Expert, EcoStruxure Process Expert (Unity Pro) and more.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-10-22 11:00 AM
I am still new to M580 and getting Modbus over TCP/IP working. I got read register (code 03h) to work but cannot get write to coil (code 05h) using function block DATA_EXCH to work. Here are my code samples along with the M580 manual references I am using and the protection relay I am writing to a 1 bit register ("coil"), if someone can pinpoint the error:
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-12-26 12:42 PM
Please check your data types and data packing. I think your issue is that you need to re-pack the data correctly. The Tx_Data array is INT, but the manual shows the structure as BYTE, WORD, BYTE. You might be better off working in a raw data BYTE array to build up the query, and then use BYTE_AS_WORD and WORD_TO_INT to push into the Tx_Data array for EMIS.
PS - do you need to use the DATA_EXCH? I think you would only use this if you expect a response form the device following the command. The standard Modbus WRITE_VAR can also write to coils, and READ_VAR can read all Modbus types.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.