I am trying to set value on a boolean memory in the S7-1200 CPU, I have used the SNAP7 library but I couldn't get success with it :
Result result = new Result();
byte[] Buffer = new byte[26];
Client.DBRead(1, 0, 2, Buffer);
result.bArret = S7.GetBitAt(Buffer, 0, 1);
result.bMarche = S7.GetBitAt(Buffer, 0, 2);
Client.DBWrite(1, 0, 10, buff);
My goal is to be able to write value on memory :
Here is the DataBlock 1 :
I need to accomplish this task without using OPC or some other third software.
Problem solved by replacing Merkers by datablock variables , here is an example :
S7Client client = new S7Client();
int res = client.ConnectTo("192.168.0.10", 0, 0);
int DBNumber;
int Size;
int Result;
byte[] buffer = new byte[2];
DBNumber = System.Convert.ToInt32(1);
Size = System.Convert.ToInt32(2);
Result = client.DBWrite(DBNumber, 0, Size, buffer);
buffer[0] = 1;
buffer[1] = 1;
Result = client.DBWrite(DBNumber, 0, Size, buffer);
hope that someone will found it usefull in the future.