Has this been resolved?
I have experienced somewhat similar situation: I am able to write to the (S7-1500 OpenController) PLC but eventually it will stop writing. Or is it the case that the PLC stops accepting the external writing?
It seems like the connection to the controller is established, the write function is excecuted without error and connection is finally closed.
When writing to PLC from the windows application stops working, the PC part has to be restarted to be able to write again. But the same situation keeps repeating itself.
logText(string.format("Card {0} detected in range. ", cardID));
logText(string.format("Previous detected state is {0}", prevDectedStatus));
logText("Attempting to open a connectiong to the PLC");
plc.Open();
if (plc.IsConnected)
{
logText("Connection established");
try
{
// The RFID
rfidValue.Value = cardID;
rfidValue.Count = cardID.Length;
// The DateTime datatype must be of the correct S7 format.
String dt = DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss");
rfidTime.Value = DateTime.ParseExact(dt, "yyyy-MM-dd-HH:mm:ss", null);
// Card in range
rfidDet.Value = isCardDetected;
dataItemsWrite.Add(rfidValue);
dataItemsWrite.Add(rfidTime);
dataItemsWrite.Add(rfidDet);
logText(string.format("Attempting to write rfid={0}, time={1}, detected={2}", rfidValue.Value, rfidTime.Value, rfidDet.Value));
plc.Write(dataItemsWrite.ToArray());
logText("Done writing to PLC");
}
catch (Exception ex){
logText(string.format("Caught an exception: {0}", ex));
}
}
else
{
logText("Failed to establish a connection to PLC");
}
logText("Store state (prev=cur), used when card leaves field");
prevDectedStatus = isCardDetected;
logText("Done storing state");
logText("Attempt to close connection to PLC");
plc.Close();
logText("Done, connection is " + (plc.IsConnected ? "open":"closed"));