Reputation: 143
I'm trying to connect to a S7 1212 using this library. I can connect to the PLC fine, but whenever I try and read a tag I get the error exception Received 12 bytes: '32-02-00-00-00-00-00-00-00-00-81-04', expected 19 bytes.
I'm using the latest version of the software, and as far as I can tell, the PLC is set up correctly. My code is as basic as it can be:
using (var plc = new Plc(CpuType.S71200, "10.10.10.180", 0, 1))
{
plc.Open();
try
{
bool tagName = (bool)plc.Read("DB1.DBX0.0");
Console.WriteLine("Tag Name: " + tagName);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
DB1 and OB1:
Network:
The permissions are full access and PUT/GET communication is allowed:
And the Datablock Optimised block access is turned off.
Any idea's why I am getting this error?
Upvotes: 4
Views: 2108
Reputation: 11
I also had this issue, as noted it comes down to the settings being sent to the PLC. You have to write hardware changes to make this work.
Upvotes: 1
Reputation: 143
The issue was with the PLC itself, not being compiled and downloaded to the CPU (in case this helps anyone else)
Upvotes: 3