Beispiel #1
0
        /// <summary>
        /// 查询PLC的状态信息
        /// </summary>
        private void PollPLCStatus()
        {
            //先查询PLC的状态
            switch (curPlcCmd)
            {
            case ReadPlcCtrlCmd.ReadW3300:          //先查询PLC是否启动工控机
                comm.ReadWRData(33, 0, 1);
                break;

            case ReadPlcCtrlCmd.ReadW3301:          //先查询PLC是否打完一个螺丝
                comm.ReadWRData(33, 1, 1);
                break;

            case ReadPlcCtrlCmd.ReadW3302:          //先查询PLC是否启动工控机采集扭矩
                comm.ReadWRData(33, 2, 1);
                break;

            case ReadPlcCtrlCmd.ReadW3303:          //先查询PLC是否允许参数写入
                comm.ReadWRData(33, 3, 1);
                break;

            default:
                comm.ReadWRData(33, 4);
                break;
            }

            //再查询报警信息(要不要先判断是否启动工控机)
            switch (curErrorCmd)
            {
            case ReadErrorCmd.ReadW20000:           //先查看w20000开始的七个报警信息
                comm.ReadWRData(200, 7);
                break;

            case ReadErrorCmd.ReadW20201:           //再查询w20201开始的四个报警信息
                comm.ReadWRData(202, 4);
                break;

            case ReadErrorCmd.ReadW20300:          //再查询w20300开始的两个报警信息
                comm.ReadWRData(203, 2);
                break;

            case ReadErrorCmd.ReadW20400:          //再查询w20400开始的七个报警信息
                comm.ReadWRData(204, 7);
                break;

            default:
                break;
            }
        }