Пример #1
0
        public static void moveEventHandle()
        {
            while (started)
            {
                if (goHomeFlag != 0)
                {
                    if (startGoHome != 0)
                    {
                        if (NO_ORG == startSearchHome(ref mAxis[X]))
                        {
                            // AfxMessageBox(_T("X轴没有找到原点!"), MB_OK, MB_ICONEXCLAMATION);
                            //m_axis[0].m_home_flag=false;
                            Console.WriteLine("X轴没有找到原点");
                        }
                        else
                        {
                            delayTime(100);
                            RFIDControl.dmc_write_sevon_pin(0, 0, LOW);
                            singleAxisMove(ref mAxis[X], (long)(-42 * line_coefficient), ABS_MODE);
                            while (RFIDControl.dmc_check_done(mAxis[X].m_card_num, mAxis[X].m_axis_num) == RUN)
                            {
                                ;
                            }
                            RFIDControl.dmc_write_sevon_pin(0, 0, HIGH);
                            delayTime(100);
                            RFIDControl.dmc_set_position(mAxis[X].m_card_num, mAxis[X].m_axis_num, 0); //设置零点
                            RFIDControl.dmc_set_encoder(0, 0, 0);                                      //设置初始值为0
                        }
                        ;                                                                              //m_axis[0].m_home_flag=true;
                    }
                    if (startGoHome != 0)
                    {
                        if (NO_ORG == startSearchHome(ref mAxis[Y]))
                        {
                            // AfxMessageBox(_T("U轴没有找到原点!"), MB_OK, MB_ICONEXCLAMATION);
                            Console.WriteLine("U轴没有找到原点");
                        }
                        else
                        {
                            delayTime(100);
                            RFIDControl.dmc_write_sevon_pin(0, 1, LOW);
                            singleAxisMove(ref mAxis[Y], (long)(820 * cicle_coefficient), ABS_MODE);
                            while (RFIDControl.dmc_check_done(mAxis[Y].m_card_num, mAxis[Y].m_axis_num) == RUN)
                            {
                                ;
                            }
                            RFIDControl.dmc_write_sevon_pin(0, 1, HIGH);
                            delayTime(100);
                            RFIDControl.dmc_set_position(mAxis[Y].m_card_num, mAxis[Y].m_axis_num, 0); //设置零点
                            RFIDControl.dmc_set_encoder(0, 1, 0);                                      //设置初始值为0
                        }
                    }

                    delayTime(100);
                    startGoHome = 0;
                    goHomeFlag  = 0;
                }
            }
        }
Пример #2
0
 public static void closeBoard()
 {
     mServoIo.check_flag = 1;
     for (int i = 0; i < AXIS_NUM; ++i)
     {
         RFIDControl.dmc_write_sevon_pin(mAxis[i].m_card_num, mAxis[i].m_axis_num, HIGH);      //伺服OFF
         RFIDControl.dmc_set_inp_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, LOW, LOW);     //设置伺服 INP 低电平有效
         RFIDControl.dmc_set_alm_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, LOW, HIGH, 0); //设置 伺服ALM 高电平有效   松下伺服正常情况下输出低电平
     }
     RFIDControl.dmc_board_close();
 }