Esempio n. 1
0
 /// <summary>
 /// 强制通讯,PLC的通讯:赋值:20150922使用
 /// </summary>
 /// <param name="plcbitvar"></param>
 /// <param name="Value"></param>
 /// <param name="IsForce"></param>
 public static void SendPLCBitVar(PLCBitVar plcbitvar, bool Value, bool IsForce)
 {
     if (IsForce)
     {
         SendPLC(plcbitvar.MemoryArea, plcbitvar.Address, Value, plcbitvar.IsConverse);
         plcbitvar.CurrentValue = Value;
     }
     else
     {
         if (plcbitvar.CurrentValue == Value)
         {
         }
         else
         {
             SendPLC(plcbitvar.MemoryArea, plcbitvar.Address, Value, plcbitvar.IsConverse);
             plcbitvar.CurrentValue = Value;
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        ///  根据数据库构造DIDOList
        /// </summary>
        public static void BuildPLCDIDOListFromDB(List <PLCBitVar> PLCDIDOList, string DBPath, string TableName)
        {
            PLCDIDOList.Clear();
            List <string[]> StringsListFromDB = Utility.MDBComm.ReadAllStringFromTable(DBPath, TableName);

            for (int i = 0; i < StringsListFromDB.Count; i++)
            {
                PLCBitVar PLCDIDOVar = new PLCBitVar();
                PLCDIDOVar.Name       = StringsListFromDB[i][0];
                PLCDIDOVar.MemoryArea = StringsListFromDB[i][1];
                PLCDIDOVar.Address    = StringsListFromDB[i][2];
                PLCDIDOVar.Initial    = (StringsListFromDB[i][3] == "false") ? false : true;
                PLCDIDOVar.IsConverse = (StringsListFromDB[i][4] == "false") ? false : true;


                PLCDIDOList.Add(PLCDIDOVar);
            }
            PLCDOList.TrimExcess();
        }
Esempio n. 3
0
        /// <summary>
        /// 读取20150914 :通过PLCBitVar读取!返回状态
        /// </summary>
        /// <param name="plcbitvar"></param>
        /// <returns></returns>

        public static bool ReadPLCBitVar(PLCBitVar plcbitvar)
        {
            return(ReadPLC(plcbitvar.MemoryArea, plcbitvar.Address, plcbitvar.IsConverse));
        }