private void cmdFlashLED_Click(object sender, EventArgs e)
        {
            // Flash the LED of the specified DAQ device with FlashLED()

            if (DaqBoard != null)
            {
                DaqBoard.FlashLED();
            }
        }
        private void cmdFlashLED_Click(object sender, EventArgs e)
        {
            MccDaq.MccBoard daqBoard = (MccDaq.MccBoard)cmbBoxDiscoveredDevs.SelectedItem;

            // Flash the LED of the specified DAQ device with FlashLED()

            if (daqBoard != null)
            {
                daqBoard.FlashLED();
            }
        }
 /************************************************************************/
 public static int GetBoardNum(string dev)
 {
     for (int BoardNum = 0; BoardNum < 99; BoardNum++)
     {
         MccDaq.MccBoard daq = new MccDaq.MccBoard(BoardNum);
         if (daq.BoardName.Contains(dev))
         {
             Console.WriteLine("USB-{0} board number = {1}", dev, BoardNum.ToString());
             daq.FlashLED();
             return BoardNum;
         }
     }
     return -1;
 }
Пример #4
0
 public static int GetBoardNum(string dev)
 {
     for (int BoardNum = 0; BoardNum < 99; BoardNum++)
     {
         MccDaq.MccBoard daq = new MccDaq.MccBoard(BoardNum);
         if (daq.BoardName.Contains(dev))
         {
             Console.WriteLine("USB-{0} board number = {1}", dev, BoardNum.ToString());
             daq.FlashLED();
             return(BoardNum);
         }
     }
     return(-1);
 }
Пример #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            System.Boolean Boardfound = false;
            MccDaq.DaqDeviceManager.IgnoreInstaCal();
            inventory = MccDaq.DaqDeviceManager.GetDaqDeviceInventory(MccDaq.DaqDeviceInterface.Any);
            System.Int32 numDevDiscovered = inventory.Length;

            if (numDevDiscovered > 0)
            {
                for (System.Int16 BoardNum = 0; BoardNum < numDevDiscovered; BoardNum++)
                {
                    try
                    {
                        DaqBoard = MccDaq.DaqDeviceManager.CreateDaqDevice(BoardNum, inventory[BoardNum]);
                        if (DaqBoard.BoardName.Contains("E-1608"))
                        {
                            Boardfound = true;
                            DaqBoard.FlashLED();
                            break;
                        }
                        else
                        {
                            MccDaq.DaqDeviceManager.ReleaseDaqDevice(DaqBoard);
                        }
                    }
                    catch (MccDaq.ULException ule)
                    {
                        System.Windows.Forms.MessageBox.Show(ule.Message, "Плата не обнаружена");
                    }
                }
            }

            if (Boardfound == false)
            {
                System.Windows.Forms.MessageBox.Show("E-1608 не найден. Запустите InstaCal", "Плата не обнаружена");
                this.Close();
            }
            System.String mystring = DaqBoard.BoardName.Substring(0, DaqBoard.BoardName.Trim().Length) + " найдена под номером: " + DaqBoard.BoardNum.ToString();
            this.Text = mystring;
            LoadComboBox(cmboAInRange);
            DaqBoard.BoardConfig.GetNumAdChans(out numchannels);
            nudAInChannel.Maximum = numchannels - 1;

            for (int i = 1; i < 10; i++)
            {
                cbRate.Items.Add(i * 10);
            }
            cbRate.SelectedIndex = 1;
        }
Пример #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //First Lets make sure there's a USB-1408FS plugged in,
            System.Int16   BoardNum;
            System.Boolean Boardfound = false;
            for (BoardNum = 0; BoardNum < 99; BoardNum++)
            {
                DaqBoard = new MccDaq.MccBoard(BoardNum);
                if (DaqBoard.BoardName.Contains("1408FS"))
                {
                    Boardfound = true;
                    DaqBoard.FlashLED();
                    break;
                }
            }

            if (Boardfound == false)
            {
                System.Windows.Forms.MessageBox.Show("No USB-1408FS found in system.  Please run InstaCal.", "No Board detected");
                this.Close();
            }
            else
            {
                System.String mystring = DaqBoard.BoardName.Substring(0, DaqBoard.BoardName.Trim().Length - 1) +
                                         " found as board number: " + BoardNum.ToString();
                this.Text = mystring;

                //Initialize objects on the form needing attention
                LoadComboBox(cmboAInRange);

                //Determine if the device is set for single ended or differential by the number of channels.
                //use the value returned to set the NumericUpDown Control
                DaqBoard.BoardConfig.GetNumAdChans(out numchannels);
                nudAInChannel.Maximum = numchannels - 1;

                //set up sample timing
                for (int i = 1; i < 11; i++)
                {
                    cbRate.Items.Add(i);
                }
                cbRate.SelectedIndex = 9;
            }
        }
Пример #7
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";
            }
        }
Пример #8
0
        public OutputManagement()
        {
            try
            {
                ErrorInfo.ErrorCode errorCode;
                DaqBoard = new MccDaq.MccBoard(0);
                MccDaq.ErrorInfo ULStat;

                ULStat    = MccDaq.MccService.ErrHandling(ErrorReporting.DontPrint, ErrorHandling.DontStop);
                errorCode = PrintError(ULStat);

                if (ErrorInfo.ErrorCode.NoErrors == PrintError(ULStat))
                {
                    ULStat = DaqBoard.FlashLED();
                }

                if (ErrorInfo.ErrorCode.NoErrors == PrintError(ULStat))
                {
                    ULStat = DaqBoard.DConfigPort(DigitalPortType.FirstPortA, DigitalPortDirection.DigitalOut);
                }

                if (ErrorInfo.ErrorCode.NoErrors == PrintError(ULStat))
                {
                    //It take sometimes for the output to be usable;
                    Console.WriteLine("Board found");
                    Thread.Sleep(500);
                    BoardFound = true;
                    SetAllOff();
                }
            }
            catch (Exception e)
            {
                BoardFound = false;
                SimpleLogger.Logger.Log("Board not found", e);
            }
        }
Пример #9
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //First Lets make sure there's an E-1608 plugged in,
            System.Boolean Boardfound = false;

            //First Lets make sure there's an E-1608 plugged in,
            MccDaq.DaqDeviceManager.IgnoreInstaCal(); //Don't use Information from InstaCal

            //Load all the boards it can find
            inventory = MccDaq.DaqDeviceManager.GetDaqDeviceInventory(MccDaq.DaqDeviceInterface.Any);
            System.Int32 numDevDiscovered = inventory.Length; //how many was that?

            if (numDevDiscovered > 0)
            {
                for (System.Int16 BoardNum = 0; BoardNum < numDevDiscovered; BoardNum++)
                {
                    try
                    {
                        DaqBoard = MccDaq.DaqDeviceManager.CreateDaqDevice(BoardNum, inventory[BoardNum]);
                        if (DaqBoard.BoardName.Contains("E-1608"))
                        {
                            Boardfound = true;
                            DaqBoard.FlashLED();
                            break;
                        }
                        else
                        {
                            MccDaq.DaqDeviceManager.ReleaseDaqDevice(DaqBoard);
                        }
                    }
                    catch (MccDaq.ULException ule)
                    {
                        System.Windows.Forms.MessageBox.Show(ule.Message, "No Board detected");
                    }
                }
            }

            if (Boardfound == false)
            {
                System.Windows.Forms.MessageBox.Show("No E-1608 series board found in system.  Please run InstaCal.", "No Board detected");
                this.Close();
            }

            System.String mystring = DaqBoard.BoardName.Substring(0, DaqBoard.BoardName.Trim().Length) +
                                     " found as board number: " + DaqBoard.BoardNum.ToString();
            this.Text = mystring;

            //Initialize controls on the form needing attention
            LoadComboBox(cmboAInRange);

            //Determine if set for single ended or differential by the number of channels.
            DaqBoard.BoardConfig.GetNumAdChans(out numchannels);
            nudAInChannel.Maximum = numchannels - 1;

            //set up sample timing
            for (int i = 1; i < 11; i++)
            {
                cbRate.Items.Add(i);
            }
            cbRate.SelectedIndex = 9;
        }