示例#1
0
        /// <summary>
        /// 设置当前参数到ATQ设备
        /// </summary>
        /// <param name="list"> 功能集合 </param>
        /// <param name="groupBox"> 包含需设置的参数 </param>
        /// <param name="Pattern"> 模式 </param>
        /// <param name="node"> 程序号 </param>
        internal void SetATQPara(SerialPort port, List <ParaObject> list, GroupBox groupBox, CheckBox Pattern, string node)
        {
            pps = PortServcie.Install();
            // 第一步 选择程序号
            string ID = mbTool.GetSoftwareID(node);

            infostring = "程序号";
            pps.WriteByte(port, ID);

            //第二步  设置模式 (1) 爆破 or leak
            infostring = "模式";
            bool pattern = LoadPattern(Pattern, node); //爆破 true  leak false

            string command = "";

            if (pattern)
            {
                command = "FF106015000204881300007710"; //burst
                pps.WriteByte(port, command);
            }
            else
            {
                command = "FF106015000204e803000068D5"; // leak
                pps.WriteByte(port, command);
            }
            Form1.form1.AddInformation("设置" + Pattern.Name + "模式参数");
            //第三步 设置各种参数

            foreach (Control c in groupBox.Controls)
            {
                if (c is TextBox)
                {
                    TextBox tb    = c as TextBox;
                    string  value = tb.Text;
                    double  outdu;
                    if (double.TryParse(value, out outdu))
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (tb.Name == list[i].English)
                            {
                                Form1.form1.AddInformation("设置" + list[i].Chinese + "模式参数");
                                //设置进度条到哪了
                                form.progressBar_Setting.Value = i + 1;
                                ParaObject para     = list[i];
                                string     ateqInfo = mbTool.GetATEQString(false, para.WriteWord, para.Write, outdu);
                                infostring = para.Chinese;
                                //INI文件中值与tb.text不一致 设置到仪器里
                                string checkValue = INIHelper.Read(node, tb.Name, "", _iniSoftwarePath);
                                if (checkValue != value)
                                {
                                    pps.WriteByte(port, ateqInfo);
                                }
                            }
                        }
                    }
                }
            }
            Form1.form1.AddInformation("参数保存在机台成功.");
        }
示例#2
0
        public static PortServcie Install()
        {
            if (paraServcie == null)
            {
                paraServcie = new PortServcie();
            }

            return(paraServcie);
        }
示例#3
0
        //1.读取参数 -- 根据程序号读取模式
        //2.根据模式。选择对应的枚举。将枚举中所有的字段值去匹配List中功能号。。。
        //串口发送modbus

        /// <summary>
        ///
        /// </summary>
        /// <param name="port">串口对象</param>
        /// <param name="list">功能集合</param>
        /// <param name="node">程序号(不用减一)</param>
        internal void ReadATQToINI(SerialPort port, string node)
        {
            pps = PortServcie.Install();
            // 第一步 选择程序号
            ModBusTools modbustool = new ModBusTools();

            CodeIndex = node;
            pps.WriteByte(port, modbustool.GetSoftwareID(node));
            string ReadmodeCode = "FF0320150001";

            ReadmodeCode           = ReadmodeCode + modbustool.CRC(ReadmodeCode);
            PortServcie.IsReadMode = true;
            pps.WriteByte(port, ReadmodeCode);
        }