コード例 #1
0
ファイル: HtmAio.cs プロジェクト: xhyangxianjun/ASMZZZ
        internal void Open()
        {
            lock (asynLocker)
            {
                if (IsOpen)
                {
                    Close();
                }
                HTM.IO_INFO ioInfo;
                int         ioCount = HTM.GetIoNum();
                for (int i = 0; i < ioCount; i++)
                {
                    int opt = HTM.GetIoInfo(i, out ioInfo);
                    if (0 != opt)
                    {
                        throw new Exception(string.Format("获取HTM-IO信息失败:HTM.GetIoInfo(i = {0},out ioInfo) return ErrorCode = {1}", i, opt));
                    }
                    if ((int)HTM.IoCardType.AIO_HTNET == ioInfo.cardType)
                    {
                        if (ioInfo.ioDir == 0) //AIn,
                        {
                            aiIndex.Add(i);
                        }
                        else//AOut
                        {
                            aoIndex.Add(i);
                        }
                    }
                }

                AICount = aiIndex.Count;
                AOCount = aoIndex.Count;
                IsOpen  = true;
            }
        }
コード例 #2
0
        internal void Open()
        {
            lock (asynLocker)
            {
                if (IsOpen)
                {
                    Close();
                }
                HTM.IO_INFO ioInfo;
                //int? ioMaxCount = dev.GetInitParamValue("最大IO数量") as int?;
                //if (null == ioMaxCount)
                //    throw new Exception("HTM控制器初始化参数\"最大IO数量\"未设置! ");
                int ioCount = HTM.GetIoNum();
                for (int i = 0; i < ioCount; i++)
                {
                    int opt = HTM.GetIoInfo(i, out ioInfo);
                    if (0 != opt)
                    {
                        throw new Exception(string.Format("获取HTM-IO信息失败:HTM.GetIoInfo(i = {0},out ioInfo) return ErrorCode = {1}", i, opt));
                    }
                    if ((int)HTM.IoCardType.DIO_HTNET == ioInfo.cardType)
                    {
                        if (ioInfo.ioDir == 0) //DIn,
                        {
                            diIndex.Add(i);
                        }
                        else//DOut
                        {
                            doIndex.Add(i);
                        }
                    }
                }

                DICount = diIndex.Count;
                DOCount = doIndex.Count;
                IsOpen  = true;
            }
        }
コード例 #3
0
ファイル: HTMMotionDaq.cs プロジェクト: xhyangxianjun/ASMZZZ
        bool HasAio()
        {
            bool isAioExisted = false;

            HTM.IO_INFO ioInfo;
            //int? ioMaxCount = dev.GetInitParamValue("最大IO数量") as int?;
            //if (null == ioMaxCount)
            //    throw new Exception("HTM控制器初始化参数\"最大IO数量\"未设置! ");
            int ioCount = HTM.GetIoNum();

            for (int i = 0; i < ioCount; i++)
            {
                int opt = HTM.GetIoInfo(i, out ioInfo);
                if (0 == opt)
                {
                    if ((int)HTM.IoCardType.AIO_HTNET == ioInfo.cardType)
                    {
                        isAioExisted = true;
                        break;
                    }
                }
            }
            return(isAioExisted);
        }