コード例 #1
0
        public static void StartEMPZ()
        {
            //設定使用Card
            MCCL.SYS_CARD_CONFIG stCardConfig = new MCCL.SYS_CARD_CONFIG();
            stCardConfig.wCardType = 4;
            MCCL.ErrorCode eRet;
            eRet = MCCL.MCC_InitSystem(1, ref stCardConfig, 1);
            if (eRet < 0)
            {
                MessageBox.Show("MCC_InitSystem Error :" + eRet.ToString());
                return;
            }
            else
            {
                // CmdQueueSize設定
                MCCL.MCC_SetCmdQueueSize(50000, 0);
                int sixe = MCCL.MCC_GetCmdQueueSize(0);
                MessageBox.Show("" + sixe.ToString());

                //座標軸設定
                //MCCL.MCC_SetIncrease(nGroupIndex);    //相對
                MCCL.MCC_SetAbsolute(nGroupIndex);  //絕對
                int eerocode = MCCL.MCC_GetCoordType(nGroupIndex);
                if (eerocode == 0)
                {
                    MessageBox.Show("IncreaseOpen");
                }
                else if (eerocode == 1)
                {
                    MessageBox.Show("AbsoluteOpen");
                }

                //DryRun設定  DryRun可
                //MCCL.MCC_EnableDryRun();
                MCCL.MCC_DisableDryRun();
                eerocode = MCCL.MCC_CheckDryRun();
                if (eerocode == 0)
                {
                    MessageBox.Show("dryrunopen");
                }
                else if (eerocode == 1)
                {
                    MessageBox.Show("dryrunclose");
                }

                //其他設定
                //MCCL.MCC_SetUnit(MCCL.UNIT_MM, 0); // coordinate unit : mm

                // 4.過形成保護
                //MCCL.MCC_EnableLimitSwitchCheck();
                //MCCL.MCC_DisableLimitSwitchCheck();
                //MCCL.MCC_SetOverTravelCheck();
                //MCCL.MCC_GetOverTravelCheck();

                //硬體極限
                //MCCL.MCC_EnableLimitSwitchCheck(0);
                //開關平滑模式
                MCCL.MCC_EnableBlend(nGroupIndex);
                //MCCL.MCC_DisableBlend(nGroupIndex);
                MCCL.MCC_CheckBlend(nGroupIndex);

                // set line, arc and circle motion's accleration time
                MCCL.MCC_SetAccType('S', nGroupIndex); //ST兩種模式而已
                MCCL.MCC_GetAccType(nGroupIndex);
                MCCL.MCC_SetAccTime(200, nGroupIndex); // set accleration time to be 300 ms
                MCCL.MCC_GetAccTime(nGroupIndex);
                // set line, arc and circle motion's deceleration time
                MCCL.MCC_SetDecType('S', nGroupIndex);
                MCCL.MCC_GetDecType(0);
                MCCL.MCC_SetDecTime(200, nGroupIndex); // set decleration time to be 300 ms
                MCCL.MCC_GetDecTime(nGroupIndex);

                MCCL.MCC_SetFeedSpeed(10, nGroupIndex); //  set line, arc and circle motion's feed rate (unit : mm/sec)

                MCCL.MCC_SetPtPAccType('S', 'S', 'S', 'S', 'S', 'S', 'S', 'S', nGroupIndex);
                //MCCL.MCC_GetPtPAccType();
                //MCCL.MCC_SetPtPAccTime();
                //MCCL.MCC_GetPtPAccTime();
                MCCL.MCC_SetPtPDecType('S', 'S', 'S', 'S', 'S', 'S', 'S', 'S', nGroupIndex);
                //MCCL.MCC_GetPtPDecType();
                //MCCL.MCC_SetPtPDecTime();
                //MCCL.MCC_GetPtPDecTime();

                MCCL.MCC_SetPtPSpeed(10, nGroupIndex); //  set line, arc and circle motion's feed rate (unit : mm/sec)
                MCCL.MCC_GetPtPSpeed(nGroupIndex);

                //MCCL.MCC_SetPGain(60, 60, 60, 60, 60, 60, 60, 60, 0); // set appropriate P Gain
            }
        }