Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I was able to establish a connection with the S7-1200. Reads positively all registers. However, when trying to write to the Holding Registry [table below]

position offset 0.2 and using the command

modbusClient.WriteSingleCoil(2, true);

value to true changes to offset 5.0

Could someone please tell me what the error or error of my command is.

You wrote a TRUE command to the relay to change state and that caused the status to change. I would think writing a FALSE will set back to original condition. – jdweng Feb 17 at 16:34 I don't think you understand my question. what digit should be in this place [?] to write [1] in [Name of value] ,[Datatype],[offset]... Alarm_1ST_Zone2,Bool,0.2.. modbusClient.WriteSingleCoil(?, true); Because if I use the expression: offset 0.2(0.2 * 16 = 3.2) rounding 3 I get a value of 1 at offset 5.0 and I don't understand why. How is the offset converted into a value in this function in the S7-1200? – Tomasz Myszak Feb 17 at 16:41 It depends on the type of relay. You can have 5V, 12V, 24V, 28V relays (these are common types). So thresh hold can be different. Some relays also have TTL drivers. Then sending a HIGH may give status back as HIGH or LOW depending on the way the relay is wired. There isn't a single answer to your question. Read the manual. – jdweng Feb 17 at 16:51

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.