0

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]

enter image description here

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.

  • Why do you think you have an error? Your relay could be switching states. – jdweng Feb 17 '23 at 14:00
  • just what should be the address in the command to change the value to true in offset 0.2 – Tomasz Myszak Feb 17 '23 at 15:35
  • 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 '23 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 '23 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 '23 at 16:51
  • I have 24V relay – Tomasz Myszak Feb 17 '23 at 17:01
  • With or Without TTL driver? 3.3V usually means you have a driver and 3.3 is the high voltage. But you are multiplying by 0.2 * 16. So 3.2 may be the MAX Low Voltage. – jdweng Feb 17 '23 at 17:08
  • I don't udnerstant yout tinking. – Tomasz Myszak Feb 18 '23 at 07:01
  • In the S7-1200 controller, offset usually refers to a memory address that points to a specific position in the programmable memory of the controller. – Tomasz Myszak Feb 18 '23 at 07:04
  • I fund the problem. Problem is in construction table of Holding Registry. Is must be a array, not Struct. If I change to Array - work. – Tomasz Myszak Feb 18 '23 at 08:12
  • Memory addresses are usually sequential integers and not fractional. The Offset number in this case look like they are boards with each board containing 8 relays. Offsets could also pertain to voltages. A relay coil usually has two voltages which can be referred to as offsets to set relay high and low. So a 24v relay the minimum high offset could be 16 volts and the maximum low offset could be .2 * 16 = 3.2v. – jdweng Feb 18 '23 at 08:18

0 Answers0