Example #1
0
        public bool SetOut(int _iNo, bool _bOn, bool _bDirect = false)
        {
            //Check Error.
            if (_iNo >= m_iMaxOut || _iNo < 0)
            {
                return(false);
            }

            //Get Addr.
            int iBitAddr;
            int iModule;
            int iModuleDp;

            GetInfoOutput(_iNo, out iModule, out iModuleDp, out iBitAddr);

            short nOn = _bOn ? (short)1 : (short)0;

            if (_bDirect)
            {
                NMC2.nmc_SetDIOOutPin(m_aModuleInfo[iModule].nNmcNo, (short)iBitAddr, nOn);
            }
            else
            {
                m_aModuleInfo[iModule].nDataOutSet[iBitAddr] = nOn;
            }

            return(true);
        }