Search code examples
c#plclibnodaves7-1200siemens

C# and PLC (S7-1200) Data Block Reading Error 33028


I am working on the connection between C# and a Siemens PLC (S7-1200). I've created a datablock (a.k.a. database) to which I need to read and eventually write. The connection to the PLC works, but I can't read anything from its datablock. It always give me the following error:

Error 33028 context is not supported. Step7 says: Function not implemented or error in telegram.

The number of the datablock is 311. I am starting at the first byte and I've only given up 1 as length.

I've also disabled Optimize block access, enabling does not solve this problem.

if (0 == lndConnection.connectPLC())
{
  Byte[]   bytes = new Byte[1];
  res = lndConnection.readBytes(libnodave.daveDB ,311,0, 1, bytes);
  if (res == 0)
     MessageBox.Show(lndConnection.getS32().ToString());
  else
  {
      mInt = 0;
      MessageBox.Show("error " + res + " " + libnodave.daveStrerror(res));
  }
} 

I hope somebody can help me out with the problem.


Solution

  • The answer from Roatin Mart: "S7-1200 has indirect access on by default. Check if Optimised Block access is disabled."