Example #1
0
        public byte InstantDi_Read()
        {
            byte      data        = 0;
            int       m_startPort = 0;
            ErrorCode err         = ErrorCode.Success;

            for (int i = 0; (i + m_startPort) < instantDiCtrl1.Features.PortCount; ++i)
            {
                err = instantDiCtrl1.Read(i + m_startPort, out data);
                if (err != ErrorCode.Success)
                {
                    HandleError(err);
                    return(0);
                }
            }
            return(data);
        }
        public byte InstantDi_Read()
        {
            int startPort = 0;
            int portCount = 1;

            byte[]    data      = new byte[4];
            ErrorCode errorCode = ErrorCode.Success;

            errorCode = instantDiCtrl1.Read(startPort, portCount, data);
            if (errorCode == ErrorCode.Success)
            {
                return(data[0]);
            }
            else
            {
                Console.WriteLine("error");
                return(0);
            }
        }