コード例 #1
0
        private void tmrReadInputs_Tick(object eventSender, System.EventArgs eventArgs) /* Handles tmrReadInputs.Tick */
        {
            MccDaq.DigitalPortType BitPort;
            string PortName, BitName;

            tmrReadInputs.Stop();

            //  read a single bit status from the digital port

            //   Parameters:
            //     PortNum    :the digital I/O port type (must be
            //                 AUXPORT or FIRSTPORTA for bit read)
            //     BitNum     :the bit to read
            //     BitValue   :the value read from the port

            BitPort = DigitalPortType.AuxPort;
            if (PortNum > BitPort)
            {
                BitPort = DigitalPortType.FifthPortA;
            }
            MccDaq.DigitalLogicState BitValue;
            MccDaq.ErrorInfo         ULStat = DaqBoard.DBitIn(BitPort, FirstBit, out BitValue);

            PortName       = BitPort.ToString();
            BitName        = FirstBit.ToString();
            lblBitNum.Text = "The state of " + PortName + " bit " + BitName
                             + " is " + BitValue.ToString();

            tmrReadInputs.Start();
        }
コード例 #2
0
        private void tmrReadInputs_Tick(object eventSender, System.EventArgs eventArgs)         /* Handles tmrReadInputs.Tick */
        {
            tmrReadInputs.Stop();

            //  read a single bit status from the digital port

            //   Parameters:
            //     PortType   :the digital I/O port type
            //     BitNum     :the bit to read
            //     BitValue   :the value read from the port
            MccDaq.DigitalLogicState BitValue;
            MccDaq.ErrorInfo         ULStat = DaqBoard.DBitIn(PortType, BitNum, out BitValue);

            lblBitNum.Text = "Bit number " + BitNum + " state is " + BitValue.ToString();

            tmrReadInputs.Start();
        }