2

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.

4

2 回答 2

2

S7-1500 实现了 libnodave 不支持的扩展通信协议。虽然可以使用“旧”协议连接和读/写全局数据库块。

我已经与 1200 和 1500 成功通信,但需要一些额外的设置 plc 端。

S7-1200

  1. 只能访问全局 DB。
  2. 必须关闭优化块访问。

S7-1500

  1. 只能访问全局 DB。
  2. 必须关闭优化块访问。
  3. PLC 的访问级别必须为“完整”。
  4. “连接机制”必须允许外部合作伙伴 GET/PUT

可以在以下位置找到带有屏幕截图的详细信息:http: //snap7.sourceforge.net/snap7_client.html

希望能帮助到你!干杯,彼得

于 2014-12-17T13:53:24.800 回答
2

Roatin Mart 的回答:“S7-1200 默认开启间接访问。检查优化块访问是否被禁用。”

于 2014-08-30T17:37:41.970 回答