Esempio n. 1
0
        public int SetPlcDateTime(DateTime DateTime)
        {
            int Length;

            LastError = 0;
            S7.SetDateAt(S7_SET_DT, 31, DateTime);

            SendPacket(S7_SET_DT);
            if (LastError == 0)
            {
                Length = RecvIsoPacket();
                if (Length > 30) // the minimum expected
                {
                    if (S7.GetWordAt(PDU, 27) != 0)
                    {
                        LastError = errS7FunctionError;
                    }
                }
                else
                {
                    LastError = errS7InvalidPDU;
                }
            }

            return(LastError);
        }