Exemplo n.º 1
0
        private void cmdEndProgram_Click(object eventSender, System.EventArgs eventArgs)         /* Handles cmdEndProgram.Click */
        {
            ushort DataValue = 0;

            MccDaq.ErrorInfo ULStat = DaqBoard.DOut(PortNum, DataValue);


            Application.Exit();
        }
Exemplo n.º 2
0
        private void hsbSetDOutVal_Change(int newScrollValue)
        {
            //  get a value to write to the port
            ushort DataValue = (ushort)newScrollValue;

            txtValSet.Text = DataValue.ToString("0");

            //  write the value to the output port
            //   Parameters:
            //     PortNum    :the output port
            //     DataValue  :the value written to the port

            MccDaq.ErrorInfo ULStat = DaqBoard.DOut(PortNum, DataValue);

            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                lblShowValOut.Text = DataValue.ToString("0");
            }
        }
Exemplo n.º 3
0
        private void cmdEndProgram_Click(object eventSender, System.EventArgs eventArgs)
        {
            ushort DataValue = 0;

            if (ProgAbility == clsDigitalIO.PROGPORT)
            {
                MccDaq.ErrorInfo ULStat = DaqBoard.DOut(PortNum, DataValue);

                Direction = MccDaq.DigitalPortDirection.DigitalIn;
                ULStat    = DaqBoard.DConfigPort(PortNum, Direction);
            }

            Application.Exit();
        }
Exemplo n.º 4
0
 public ErrorInfo.ErrorCode SetAllOff()
 {
     lock (this)
     {
         Console.WriteLine("SetAllOff");
         if (!BoardFound)
         {
             return(ErrorInfo.ErrorCode.BoardNotExist);
         }
         MccDaq.ErrorInfo ULStat;
         ULStat = DaqBoard.DOut(DigitalPortType.FirstPortA, 0);
         return(PrintError(ULStat));
     }
 }
Exemplo n.º 5
0
        // *----------------------------------------------------------------*
        // *     Initialisation and configuration of the card               *
        // *----------------------------------------------------------------*
        /// <summary>
        /// Constructor that initialise the card
        /// </summary>
        public Card()
        {
            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.
            //              -> PrintAll  : all warnings and errorsencountered will be printed
            //              -> DontPrint : No error printing (in production)
            //     MccDaq.ErrorHandling.
            //              -> StopAll  : If an error is encountered, the program will stop
            //              -> DontStop : No stop (in production)
            ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.DontPrint, MccDaq.ErrorHandling.DontStop);

            // select the first card (the only connected)
            DaqBoard = new MccDaq.MccBoard(0);
            ULStat = DaqBoard.FlashLED();

            //  looking if the card is connected
            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                // if no errors, configuring the card
                GlobalVariables.mode = "normal";

                // FirstPortA as output for heating control
                ULStat = DaqBoard.DConfigPort(MccDaq.DigitalPortType.FirstPortA, MccDaq.DigitalPortDirection.DigitalOut);
                ULStat = DaqBoard.DOut(MccDaq.DigitalPortType.FirstPortA, 0); // All is off at startup

                // FirstPortB as input for door and windows
                ULStat = DaqBoard.DConfigPort(MccDaq.DigitalPortType.FirstPortB, MccDaq.DigitalPortDirection.DigitalIn);
            }
            else
            {
                // if error, simulation mode and blocking the card
                GlobalVariables.mode = "simulation";
            }
        }