Exemple #1
0
        public int GetAxisStatus(int id, int axis, out int sts)
        {
            sts = 0;

            int  pSts, homeSts;
            uint clock;
            var  ret = mc.GT_GetSts((short)id, (short)axis, out pSts, 1, out clock);

            if (ret != 0)
            {
                return(-1);
            }

            ret = mc.GT_GetDi((short)id, mc.MC_HOME, out homeSts);
            if (ret != 0)
            {
                return(-1);
            }

            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_ALM, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.ALARM));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_PEL, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.LMTP));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_MEL, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.LMTN));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_ORG, BitOperateHelper.GetBit(homeSts, 0x01 << axis - 1));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_EMG, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.EmgStop));

            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_SVON, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.ENABLE));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_STS_MDN, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.PRFMOVEING));
            BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_STS_ASTP, BitOperateHelper.GetBit(pSts, (int)GtsAxisDefine.EmgStop));

            return(ret);
        }
Exemple #2
0
        public int GetAxisStatus(int id, int axis, out int sts)
        {
            lock (this)
            {
                Thread.Sleep(1);
                sts = 0;


                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_ALM, AxisStatus[axis].Alarm);
                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_PEL, AxisStatus[axis].Pel);
                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_MEL, AxisStatus[axis].Mel);
                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_ORG, AxisStatus[axis].Org);
                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_EMG, AxisStatus[axis].Astp);
                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_IO_SVON, AxisStatus[axis].Servo);

                BitOperateHelper.SetBit(ref sts, MotionAxisDefine.MOTION_STS_MDN, AxisStatus[axis].Mdn);

                return(0);
            }
        }