S7NetPlus / s7netplus

S7.NET+ -- A .NET library to connect to Siemens Step7 devices
MIT License
1.29k stars 577 forks source link

s71500 write bit M9.2 How to read and write? #486

Open anan1213095357 opened 1 year ago

anan1213095357 commented 1 year ago

s71500 write bit M9.2 How to read and write?

mycroes commented 1 year ago

What about plc.Read("M9.2")? I have my doubts looking at the code for converting the resulting data to bool, but this should be the way to read. As for writing, plc.Write("M9.2", true) should be enough, however I won't make any promises that it actually works.

I don't have a PLC to test this against and I have never used memory bits, but the above should get you going.

anan1213095357 commented 1 year ago

Yes, after I write this way, it's invalid

mycroes commented 1 year ago

Please provide some more detail:

I'm assuming you're using something along the lines of what I provided above, but please provide an exact sample that causes your issue.

anan1213095357 commented 4 months ago

Please provide some more detail:

  • Provide code that reproduces this issue
  • Explain what happens
  • Explain what would've been the expected behavior

I'm assuming you're using something along the lines of what I provided above, but please provide an exact sample that causes your issue.

_plc.WriteBit(S7.Net.DataType.Memory, 9, 0, 0, true); I read normally and write abnormally