예제 #1
0
        /// <summary>
        /// 向FICT PLC 发送命令
        /// </summary>
        /// <param name="commandStr">发送的命令</param>
        private void sendPLC(string commandStr)
        {
            string sA = commandStr.Substring(0, 1);
            string sB = commandStr.Substring(1, 1);

            if (writePLC(FICT_PLC_Write_AddressA, Other.Asc(sA)) && writePLC(FICT_PLC_Write_AddressB, Other.Asc(sB)))
            {
                SubFunction.updateMessage(lstCommandList, "PC->PLC:" + commandStr);
                SubFunction.saveLog(Param.logType.SYSLOG.ToString(), "PC->PLC:" + commandStr);
                SubFunction.saveLog(Param.logType.COMLOG.ToString(), "PC->PLC:" + commandStr);
            }
            else
            {
                SubFunction.updateMessage(lstCommandList, "PC->PLC:" + commandStr + " Fail");
                SubFunction.saveLog(Param.logType.SYSLOG.ToString(), "PC->PLC:" + commandStr + " Fail");
                SubFunction.saveLog(Param.logType.COMLOG.ToString(), "PC->PLC:" + commandStr);
            }
        }