Esempio n. 1
0
        /// <summary>
        ///     切换轴运动为Jog运动
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <returns></returns>
        public override short PrfJog(short nCardNum, short nAxis)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_PrfJog(nCardNum, nAxis);
            return(nRtn);
        }
Esempio n. 2
0
        /// <summary>
        ///     清除插补坐标系数据
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="crd">坐标系号 1跟2</param>
        /// <param name="count">不用管</param>
        /// <param name="fifo">缓冲区号 fifo0  fifo1</param>
        /// <returns></returns>
        public override short CrdClear(short nCardNum, short crd, short fifo, short count = 1)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_CrdClear(nCardNum, crd, fifo);
            return(nRtn);
        }
Esempio n. 3
0
        /// <inheritdoc />
        /// <summary>
        ///     轴停止
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="mask">bit0--8 哪个轴</param>
        /// <param name="option">bit0--8 对应的停止方式:1:急停, 0:平滑停止</param>
        public override short Stop(short nCardNum, short mask, short option)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_Stop(nCardNum, mask, option);
            return(nRtn);
        }
Esempio n. 4
0
        /// <summary>
        ///     轴启动
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <returns></returns>
        public override short AxisOn(short nCardNum, short nAxis)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_AxisOn(nCardNum, nAxis);
            return(nRtn);
        }
Esempio n. 5
0
        public override short BufDelay(short nCardNum, short crd, ushort delayTime, short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_BufDelay(nCardNum, crd, delayTime, fifo);
            return(nRtn);
        }
Esempio n. 6
0
        /// <summary>
        ///     设置插补坐标系
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="crd"></param>
        /// <param name="nDim">坐标系维数</param>
        /// <param name="synVelMax">坐标系的最大合成速度</param>
        /// <param name="synAccMax">坐标系的最大合成加速度</param>
        /// <param name="evenTime">坐标系的最小匀速时间</param>
        /// <param name="profile">规划器对应的轴</param>
        /// <returns></returns>
        public override short SetLineOrdi(short nCardNum, short crd, short nDim, double synVelMax, double synAccMax,
                                          short evenTime, short[] profile)
        {
            short nRtn   = 0;
            var   crdPrm = new CMc.CRD_PRM();

            crdPrm.m_dimension = nDim;      // 建立二/三/四维的坐标系
            crdPrm.m_synVelMax = synVelMax; // 坐标系的最大合成速度是: 500 pulse/ms
            crdPrm.m_synAccMax = synAccMax; // 坐标系的最大合成加速度是: 2 pulse/ms^2
            crdPrm.m_evenTime  = evenTime;  // 坐标系的最小匀速时间为0

            crdPrm.m_profile1 = profile[0];
            crdPrm.m_profile2 = profile[1];
            crdPrm.m_profile3 = profile[2];
            crdPrm.m_profile4 = profile[3];
            crdPrm.m_profile5 = profile[4];
            crdPrm.m_profile6 = profile[5];
            crdPrm.m_profile7 = profile[6];
            crdPrm.m_profile8 = profile[7];

            crdPrm.m_setOriginFlag = 1; // 需要设置加工坐标系原点位置
            crdPrm.m_originPos1    = 0; // 加工坐标系原点位置在(0,0),即与机床坐标系原点重合
            crdPrm.m_originPos2    = 0;
            crdPrm.m_originPos3    = 0;
            crdPrm.m_originPos4    = 0;
            crdPrm.m_originPos5    = 0;
            crdPrm.m_originPos6    = 0;
            crdPrm.m_originPos7    = 0;
            crdPrm.m_originPos8    = 0;

            nRtn |= CMc.GT_SetCrdPrm(nCardNum, 1, ref crdPrm);
            return(nRtn);
        }
Esempio n. 7
0
        /// <summary>
        ///     设置捕获的电平状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="mode">方式 1:Home 捕获  2:Index 捕获</param>
        /// <param name="sense">捕获电平 0:下降沿触发;1:上升沿触发</param>
        /// <returns></returns>
        public override short SetCaptureSense(short nCardNum, short nAxis, short mode, short sense)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_SetCaptureSense(nCardNum, nAxis, mode, sense); //0:下降沿触发;1:上升沿触发
            return(nRtn);
        }
Esempio n. 8
0
        /// <summary>
        ///     位置置零
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="count">粥熟了</param>
        /// <returns></returns>
        public override short ZeroPos(short nCardNum, short nAxis, short count)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_ZeroPos(nCardNum, nAxis, count);
            return(nRtn);
        }
Esempio n. 9
0
        /// <summary>
        ///     获取编码器位置
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴</param>
        /// <param name="dVal">值</param>
        /// <param name="count">轴数量</param>
        /// <returns></returns>
        public override short GetEncPos(short nCardNum, short nAxis, out double dVal, short count)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_GetEncPos(nCardNum, nAxis, out dVal, count, out m_oClk);
            return(nRtn);
        }
Esempio n. 10
0
        /// <summary>
        ///     设置捕获的电平状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="mode">方式 1:Home 捕获  2:Index 捕获</param>
        /// <returns></returns>
        public override short SetCaptureMode(short nCardNum, short nAxis, short mode)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_SetCaptureMode(nCardNum, nAxis, mode);
            return(nRtn);
        }
Esempio n. 11
0
        /// <summary>
        ///     扫描通用输出状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="status">状态信息</param>
        /// <returns></returns>
        public override short GetDo(short nCardNum, out int status)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_GetDo(nCardNum, CMc.m_c_MC_GPO, out status);
            return(nRtn);
        }
Esempio n. 12
0
        /// <summary>
        ///     扫描输入状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="diType">类型</param>
        /// <param name="diStatus">状态信息</param>
        /// <returns></returns>
        public override short GetDi(short nCardNum, short diType, out int diStatus)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_GetDi(nCardNum, diType, out diStatus);
            return(nRtn);
        }
Esempio n. 13
0
        /// <summary>
        ///     设置位置
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="nPos">位置,单位脉冲</param>
        /// <returns></returns>
        public override short SetPos(short nCardNum, short nAxis, int nPos)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_SetPos(nCardNum, nAxis, nPos);

            return(nRtn);
        }
Esempio n. 14
0
        /// <summary>
        ///     设置速度
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="vel">速度 单位是“脉冲/毫秒”</param>
        /// <returns></returns>
        public override short SetVel(short nCardNum, short nAxis, double vel)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_SetVel(nCardNum, nAxis, vel); //设置目标速度,单位是“脉冲/毫秒”

            return(nRtn);
        }
Esempio n. 15
0
        public override short BufIo(short nCardNum, short crd, ushort doType, ushort doMask, ushort doValue,
                                    short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_BufIO(nCardNum, crd, doType, doMask, doValue, fifo);
            return(nRtn);
        }
Esempio n. 16
0
        public override short LnXyza(short nCardNum, short crd, int x, int y, int z, int a, double synVel,
                                     double synAcc, double velEnd = 0, short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_LnXYZA(nCardNum, crd, x, y, z, a, synVel, synAcc, velEnd, fifo);
            return(nRtn);
        }
Esempio n. 17
0
        /// <summary>
        ///     清除轴状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="count">数量</param>
        /// <returns></returns>
        public override short ClrSts(short nCardNum, short nAxis, short count)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_ClrSts(nCardNum, nAxis, count); // 清除指定轴的报警和限位

            return(nRtn);
        }
Esempio n. 18
0
        /// <summary>
        ///     更新轴参数
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <returns></returns>
        public override short Update(short nCardNum, int nAxis)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_Update(nCardNum, 1 << (nAxis - 1));

            return(nRtn);
        }
Esempio n. 19
0
        /// <summary>
        ///     获取轴状态
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="count">轴数量</param>
        /// <param name="status">轴状态</param>
        /// <returns></returns>
        public override short GetSts(short nCardNum, short nAxis, short count, out int status)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_GetSts(nCardNum, nAxis, out status, count, out m_oClk);

            return(nRtn);
        }
Esempio n. 20
0
        /// <summary>
        ///     按索引值设置通用数字 I/O 的输出信号
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="doIndex"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override short SetDoBit(short nCardNum, short doIndex, short value)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_SetDoBit(nCardNum, CMc.m_c_MC_GPO, doIndex, value);

            return(nRtn);
        }
Esempio n. 21
0
        /// <summary>
        ///     坐标系开始运行
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="mask">bit0 对应坐标系 1,bit1 对应坐标系 2。  0:不启动该坐标系,1:启动该坐标系。</param>
        /// <param name="option">bit0 对应坐标系 1,bit1 对应坐标系 2。  0:启动坐标系中 FIFO0 的运动,1:启动坐标系中 FIFO1 的运动。</param>
        /// <returns></returns>
        public override short CrdStart(short nCardNum, short mask, short option = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_CrdStart(nCardNum, mask, option);

            return(nRtn);
        }
Esempio n. 22
0
        public override short ArcXyc(short nCardNum, short crd, int x, int y, double dCenterX, double dCenterY, short circleDir,
                                     double synVel, double synAcc, double velEnd = 0, short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_ArcXYC(nCardNum, crd, x, y, dCenterX, dCenterY, circleDir, synVel, synAcc, velEnd, fifo);
            return(nRtn);
        }
Esempio n. 23
0
        /// <summary>
        ///     使用前瞻时,把前瞻缓存区的数据压入运动缓存区
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="crd">坐标系号,取值范围[1,2]</param>
        /// <param name="fifo">插补缓存区号,0:FIFO1 1:FIFO2</param>
        /// <returns></returns>
        public override short CrdData(short nCardNum, short crd, short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_CrdData(nCardNum, crd, new IntPtr(), fifo);

            return(nRtn);
        }
Esempio n. 24
0
        /// <summary>
        ///     读取坐标系缓冲区剩余空间大小
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="crd">坐标系号,取值范围[1,2]</param>
        /// <param name="pSpace">插补缓存的剩余空间</param>
        /// <param name="count">(灵猴)轴数</param>
        /// <param name="fifo">插补缓存区号,0:FIFO1 1:FIFO2</param>
        /// <returns></returns>
        public override short CrdSpace(short nCardNum, short crd, out int pSpace, short count = 1, short fifo = 0)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_CrdSpace(nCardNum, crd, out pSpace, fifo);

            return(nRtn);
        }
Esempio n. 25
0
        /// <summary>
        ///     启动二维位置比较
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="chn">通道号 0:HSIO1 ; 通道号 1: HSIO2</param>
        /// <returns></returns>
        public override short D2DCompareStart(short nCardNum, short chn)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_2DCompareStart(nCardNum, chn);

            return(nRtn);
        }
Esempio n. 26
0
        /// <summary>
        ///     二维位置比较强制输出
        /// </summary>
        /// <param name="cardNo">卡号</param>
        /// <param name="chn">通道号</param>
        /// <param name="level">位置比较输出电平起始电平 0 1</param>
        /// <param name="outputType">输出类型:0 表示脉冲输出,1 表示电平输出</param>
        /// <param name="time">脉冲模式下输出脉冲的时间</param>
        public override short D2DComparePulse(short cardNo, short chn, short level, short outputType, short time)
        {
            short nRtn = 0;

            //清除
            nRtn |= CMc.GT_2DCompareClear(cardNo, chn);
            nRtn |= CMc.GT_2DComparePulse(cardNo, chn, level, outputType, time);
            return(nRtn);
        }
Esempio n. 27
0
        /// <summary>
        ///     获取扩展Di的输入信号
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="address">第几个扩招卡</param>
        /// <param name="status"></param>
        /// <returns></returns>
        public override short GetExtendDi(short nCardNum, short address, out ushort status)
        {
            short nRtn = 0;

            nRtn |= CMc.GT_GetExtIoValue(nCardNum, 0, out status);


            return(nRtn);
        }
Esempio n. 28
0
        /// <summary>
        ///     设置扩展数字 I/O 的输出信号
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="address">第几个扩展IO板</param>
        /// <param name="doIndex">IO索引</param>
        /// <param name="value">结果</param>
        /// <returns></returns>
        public override short SetExtendDoBit(short nCardNum, short address, short doIndex, short value)
        {
            short nRtn = 0;
            var   val  = Convert.ToUInt16(value);

            nRtn |= CMc.GT_SetExtIoValue(nCardNum, doIndex, val);

            return(nRtn);
        }
Esempio n. 29
0
        /// <summary>
        ///     初始化插补前瞻缓存区
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="crd">坐标系号,取值范围[1,2]</param>
        /// <param name="fifo">插补缓存区号,0:FIFO1 1:FIFO2</param>
        /// <param name="T">拐弯时间,取值范围[0,100],单位 ms</param>
        /// <param name="accMax">最大加速度,单位 pulse/ms^2</param>
        /// <param name="n">前瞻缓存区大小</param>
        /// <param name="lenght">前瞻缓存区内存指针</param>
        /// <returns></returns>
        public override short InitLookAhead(short nCardNum, short crd, short fifo, double T, double accMax,
                                            short lenght)
        {
            short nRtn = 0;

            m_tsBufOfLookAhead = new CMc.CRD_DATA[lenght];
            nRtn |= CMc.GT_InitLookAhead(nCardNum, crd, fifo, T, accMax, lenght, ref m_tsBufOfLookAhead[0]);

            return(nRtn);
        }
Esempio n. 30
0
        /// <summary>
        ///     获取Jog运动参数
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nAxis">轴号</param>
        /// <param name="acc">加速度</param>
        /// <param name="dec">减速度</param>
        /// <param name="smooth">平滑系数</param>
        /// <returns></returns>
        public override short GetJogPrm(short nCardNum, short nAxis, out double acc, out double dec, out double smooth)
        {
            short nRtn = 0;

            CMc.JOG_PRM trapPrm;
            nRtn  |= CMc.GT_GetJogPrm(nCardNum, nAxis, out trapPrm);
            acc    = trapPrm.m_acc;
            dec    = trapPrm.m_dec;
            smooth = trapPrm.m_smooth;

            return(nRtn);
        }