Ejemplo n.º 1
0
        private void chkSetBit_CheckStateChanged(object eventSender, System.EventArgs eventArgs)
        {
            string PortName;
            int    BitNum = Array.IndexOf(chkSetBit, eventSender);

            MccDaq.DigitalPortType BitPort;

            MccDaq.DigitalLogicState BitValue = MccDaq.DigitalLogicState.Low;
            if (chkSetBit[BitNum].Checked)
            {
                BitValue = MccDaq.DigitalLogicState.High;
            }

            //the port must be AuxPort or FirstPortA for bit output
            BitPort = MccDaq.DigitalPortType.AuxPort;
            if (PortNum > MccDaq.DigitalPortType.AuxPort)
            {
                BitPort = MccDaq.DigitalPortType.FirstPortA;
            }

            MccDaq.ErrorInfo ULStat = DaqBoard.DBitOut(BitPort, FirstBit + BitNum, BitValue);

            PortName = BitPort.ToString();
            int BitSet = FirstBit + BitNum;

            lblValueSet.Text = PortName + ", bit " + BitSet.ToString()
                               + " value set to " + BitValue.ToString();
        }
Ejemplo n.º 2
0
        private void chkSetBit_CheckStateChanged(object eventSender, System.EventArgs eventArgs)
        {
            MccDaq.DigitalPortType PortType;

            int BitNum = Array.IndexOf(chkSetBit, eventSender);

            // For boards whose first port is not FIRSTPORTA (such as the USB-ERB08
            // and the USB-SSR08) offset the BitNum by FirstBit

            if (PortNum == MccDaq.DigitalPortType.AuxPort)
            {
                PortType = MccDaq.DigitalPortType.AuxPort;
            }
            else
            {
                PortType = MccDaq.DigitalPortType.FirstPortA;
            }

            MccDaq.DigitalLogicState BitValue = MccDaq.DigitalLogicState.Low;
            if (chkSetBit[BitNum].Checked)
            {
                BitValue = MccDaq.DigitalLogicState.High;
            }

            MccDaq.ErrorInfo ULStat = DaqBoard.DBitOut(PortType, FirstBit + BitNum, BitValue);
        }
Ejemplo n.º 3
0
        private void chkSetBit_CheckStateChanged(object eventSender, System.EventArgs eventArgs)
        {
            int BitNum = Array.IndexOf(chkSetBit, eventSender);

            MccDaq.DigitalLogicState BitValue = MccDaq.DigitalLogicState.Low;
            if (chkSetBit[BitNum].Checked)
            {
                BitValue = MccDaq.DigitalLogicState.High;
            }

            MccDaq.DigitalPortType PortType = PortNum;
            MccDaq.ErrorInfo       ULStat   = DaqBoard.DBitOut(PortType, BitNum, BitValue);
            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadBitNumber)
            {
                MessageBox.Show("Boards only supports bit numbers less than " + BitNum.ToString("0"), "Bit value too high", 0);
            }
        }
 /// <summary>
 /// portNumber from 8-23
 /// </summary>
 /// <param name="portNumber">Port number</param>
 /// <param name="BitValue">DigitalLogicState</param>
 public void DigitOutput(int portNumber, MccDaq.DigitalLogicState BitValue)
 {
     DaqBoard.DBitOut(BitPort, portNumber, BitValue);
 }