Esempio n. 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     Alarm.Canshowmessage = true;
     for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)
     {
         DeviceRsDef.AxisList[i].MC_AlarmReset();
     }
     Alarm.ClearAlarm();
 }
Esempio n. 2
0
        /// <summary>
        /// 按钮事件
        /// </summary>
        private void BtEvent()
        {
            //运行按钮
            if (DeviceRsDef.I_Start.Value)
            {
                FSM.Start();
            }
            //停止按钮
            if (DeviceRsDef.I_Stop.Value)
            {
                if (FSM.Status != HzControl.Logic.FSMStaDef.RUN)
                {
                    Alarm.ClearAlarm();
                }
                FSM.Stop();
            }

            //停止按钮
            if (DeviceRsDef.I_Reset.Value)
            {
                FSM.Reset();
            }

            //急停
            if (DeviceRsDef.I_Scam.Value)
            {
                for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)
                {
                    if (DeviceRsDef.AxisList[i].status != Device.AxState.AXSTA_READY)
                    {
                        DeviceRsDef.AxisList[i].MC_Stop();
                    }
                    DeviceRsDef.AxisList[i].MC_PowerOn();
                }

                FSM.Scram();
            }
            else
            {
                //当松开急停后,状态机恢复到初始态
                if (FSM.Status == HzControl.Logic.FSMStaDef.SCRAM)
                {
                    FSM.Init();
                }
                for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)
                {
                    DeviceRsDef.AxisList[i].MC_PowerOff();
                }
            }

            if (FSM.Status == HzControl.Logic.FSMStaDef.SCRAM)
            {
                //Alarm.SetAlarm(AlarmLevelEnum.Level3, "急停按下");
            }
        }
        protected override void LogicImpl()
        {
            switch (LG.Step)
            {
            case 1:
                startNuzzleParaInit();
                for (int i = 0; i < 30; i++)
                {
                    DeviceRsDef.MotionCard.MotionFun.OutputOFF(i);
                }
                DeviceRsDef.MotionCard.MotionFun.OutputON(24);
                for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)
                {
                    DeviceRsDef.AxisList[i].MC_Stop();
                }
                Alarm.ClearAlarm();
                if (DeviceRsDef.I_XFarLimit.Value)
                {
                    DeviceRsDef.Axis_X.MC_Stop();
                    Alarm.SetAlarm(AlarmLevelEnum.Level3, "X正硬极限限位");
                }
                if (DeviceRsDef.I_YFarLimit.Value)
                {
                    DeviceRsDef.Axis_Y.MC_Stop();
                    Alarm.SetAlarm(AlarmLevelEnum.Level3, "Y正硬极限限位");
                }
                Product.Inst.ProcessData.currWhichPoint   = 0;
                Product.Inst.ProcessData.currWhichProduct = 0;
                LG.StepNext(2);
                break;

            case 2:
                if (LG.Delay(100))
                {
                    for (int i = 0; i < DeviceRsDef.AxisList.Count; i++)
                    {
                        DeviceRsDef.AxisList[i].MC_AlarmReset();
                    }
                    LG.StepNext(3);
                }
                break;

            case 3:
                if (CTRCard.ZArrive)
                {
                    DeviceRsDef.Axis_Z1.MC_Home();
                    DeviceRsDef.Axis_Z2.MC_Home();
                    LG.StepNext(4);
                }
                break;

            case 4:
                if (CTRCard.ZArrive)
                {
                    DeviceRsDef.Axis_R1.MC_Home();
                    DeviceRsDef.Axis_R2.MC_Home();
                    DeviceRsDef.Axis_X.MC_Home();
                    DeviceRsDef.Axis_Y.MC_Home();
                    LG.StepNext(5);
                }
                break;

            case 5:
                if (CTRCard.XYArrive && CTRCard.RArrive)
                {
                    LG.StepNext(0xef);
                }
                break;

            case 0xef:
                LG.End();
                FSM.Stop();
                break;
            }
        }