我连接到PLC之后,获取数据时报错,请大神分析一下,这是什么回事,谢谢啦:
S7.Net.PlcException: Received 12 bytes: '32-02-00-00-00-00-00-00-00-00-81-04', expected 19 bytes. 代码如下(使用网上提供的S7.net.dll动链):
private void btnConnect_Click(object sender, System.EventArgs e)
{
using (var plc = new Plc(CpuType.S71200, "192.168.1.2", 0, 1))
{
try
{
plc.Open();
bool dbbool1 = (bool)plc.Read("DB12.DBX0.1");
var IntVa= (ushort)plc.Read("DB12.DBW2.0");
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}