示例#1
0
        public bool SetSoftLimit(I32 positiveLimit, I32 negativeLimit, CmdStatus sw, StopType stopType)
        {
            I16 rc = -1;

            if (axisPara.IsActive && axisPara.Enabled)
            {
                if (sw == CmdStatus.ON)
                {
                    /*
                     * 0 INT only
                     * 1 Immediately stop
                     * 2 Slow down then stop
                     * 3 Reserved
                     */
                    if (stopType == StopType.Emergency)
                    {
                        rc = CCMNet.CS_mnet_m1_enable_soft_limit(RingNoOfMNet, axisPara.SlaveIP, 1);
                    }
                    else
                    {
                        rc = CCMNet.CS_mnet_m1_enable_soft_limit(RingNoOfMNet, axisPara.SlaveIP, 2);
                    }
                    rc = CCMNet.CS_mnet_m1_set_soft_limit(RingNoOfMNet, axisPara.SlaveIP, positiveLimit, negativeLimit);
                }
                else
                {
                    rc = CCMNet.CS_mnet_m1_disable_soft_limit(RingNoOfMNet, axisPara.SlaveIP);
                }
            }
            return(rc == 0 ? true : false);
        }