Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     二维位置压入
        /// </summary>
        /// <param name="nCardNum">位置比较数据个数</param>
        /// <param name="axis1">轴1坐标</param>
        /// <param name="axis2">D轴2坐标</param>
        /// <param name="chn">通道号 0:HSIO1 ; 通道号 1: HSIO2</param>
        /// <param name="fifo">数据压入的 FIFO,范围: [0,1],该数据目前保留,使用 0 即可</param>
        /// <returns></returns>
        public override short D2DCompareData(short nCardNum, List <int> axis1, List <int> axis2, short chn, short fifo)
        {
            short nRtn = 0;

            //清除
            nRtn |= CMc.GT_2DCompareClear(nCardNum, chn);

            //设置模式
            nRtn |= CMc.GT_2DCompareMode(nCardNum, chn, CMc.m_c_COMPARE2_D_MODE_2_D);

            var ll = axis1.Count;

            var maxL = ll > 1000 ? 1000 : ll;


            var td = new CMc.T2_D_COMPARE_DATA[1000];


            for (var i = 0; i < maxL; i++)
            {
                td[i].m_px = axis1[i];
                td[i].m_py = axis2[i];
            }

            //压入数据
            nRtn |= CMc.GT_2DCompareData(nCardNum, chn, (short)maxL, ref td[0], fifo);


            //如果数量超过1000个,开启线程继续压入
            if (maxL == 1000)
            {
                STRUCT_2_D_POINT t2P;
                t2P.m_listOfAxis1Position = axis1;
                t2P.m_listOfAxis2Position = axis2;
                t2P.m_indexNo             = 1000;
                t2P.m_chnNo  = chn;
                t2P.m_cardNo = nCardNum;


                var t = new Thread(ThreadAddP)
                {
                    IsBackground = true
                };

                t.Start(t2P);
            }


            return(nRtn);
        }