Example #1
0
        private void IO()
        {
            int Axisnum = (Globals.settingMachineInfo.什么机器 == WhichMachine.MMS)?1:1; //wl

            for (var i = 1; i <= Axisnum; i++)                                       //王亮修改成一个轴,原来4个
            {
                CardTmp = (int)(Conversion.Val(VB.Strings.Mid(System.Convert.ToString(this.Tag), System.Convert.ToInt32((i - 1) * 5 + 3), 1)));
                AxisTmp = (int)(Conversion.Val(VB.Strings.Mid(System.Convert.ToString(this.Tag), System.Convert.ToInt32((i - 1) * 5 + 5), 1)));


                if (AxisTmp != 0)
                {
                    long StsValue = 0;
                    StsValue = Gg.GetSts((short)CardTmp, (short)AxisTmp);

                    if ((StsValue & 0x200) == 0) //使能
                    {
                        mOvalShape[i, 1].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 1].FillColor = Color.Lime;
                    }

                    if ((StsValue & 0x2) == 0) //报警
                    {
                        mOvalShape[i, 2].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 2].FillColor = Color.Lime;
                    }

                    if ((StsValue & 0x20) == 0) //正限位
                    {
                        mOvalShape[i, 3].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 3].FillColor = Color.Lime;
                    }

                    if (Gg.GetHomeDi((short)CardTmp, (short)AxisTmp) == 0) //原点
                    {
                        mOvalShape[i, 4].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 4].FillColor = Color.Lime;
                    }

                    if ((StsValue & 0x40) == 0) //负限位
                    {
                        mOvalShape[i, 5].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 5].FillColor = Color.Lime;
                    }

                    if ((StsValue & 0x400) == 0) //运动标志
                    {
                        mOvalShape[i, 6].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 6].FillColor = Color.Lime;
                    }

                    if ((StsValue & 0x10) == 0) //误差标志
                    {
                        mOvalShape[i, 7].FillColor = Color.White;
                    }
                    else
                    {
                        mOvalShape[i, 7].FillColor = Color.Lime;
                    }
                }
                else
                {
                    if ((int)i == 1)
                    {
                        X_Axis_Name.Visible = false;
                    }
                    else if ((int)i == 2)
                    {
                        Y_Axis_Name.Visible = false;
                    }
                    else if ((int)i == 3)
                    {
                        Z_Axis_Name.Visible = false;
                    }
                    else if ((int)i == 4)
                    {
                        R_Axis_Name.Visible = false;
                    }
                    for (var j = 1; j <= 7; j++)
                    {
                        mOvalShape[i, j].Visible = false;
                    }
                }
            }
        }