예제 #1
0
        /// <summary>
        /// 获取单个输入点状态
        /// ArgumentOutofRange
        /// </summary>
        /// <param name="index">输入点序号,从0开始</param>
        /// <returns></returns>
        public int GetDI(int index, out bool isON)
        {
            if (index < 0 || index >= DICount)
            {
                throw new Exception(string.Format("GetDI(index = {0}, isON) index is out of range:0~{1}", index, DICount - 1));
            }

            isON = false;
            if (!IsOpen)
            {
                return((int)ErrorDef.NotOpen);
            }

            int val = HTM.ReadDI(diIndex[index]);

            //int val = HTM.GetDI(diIndex[index]);
            isON = val != 0;
            return((int)ErrorDef.Success);
        }