Exemplo n.º 1
0
        private bool TestOutputRanges(out MccDaq.Range DefaultRange)
        {
            short dataValue = 0;

            MccDaq.ErrorInfo ULStat;
            MccDaq.Range     TestRange;
            bool             RangeFound = false;
            int    configVal;
            string ConnectionConflict;

            ConnectionConflict = "This network device is in use by another process or user." +
                                 System.Environment.NewLine + System.Environment.NewLine +
                                 "Check for other users on the network and close any applications " +
                                 System.Environment.NewLine +
                                 "(such as Instacal) that may be accessing the network device.";

            DefaultRange = MccDaq.Range.NotUsed;
            TestRange    = (MccDaq.Range)(-5);
            ULStat       = TestBoard.AOut(0, TestRange, dataValue);
            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                ULStat = TestBoard.GetConfig(2, 0, 114, out configVal);
                if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                {
                    DefaultRange = (MccDaq.Range)configVal;
                    RangeFound   = true;
                }
            }
            else
            {
                TestRange = MccDaq.Range.NotUsed;
                foreach (int i in Enum.GetValues(TestRange.GetType()))
                {
                    TestRange = (MccDaq.Range)i;
                    ULStat    = TestBoard.AOut(0, TestRange, dataValue);
                    if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                    {
                        if (DefaultRange == MccDaq.Range.NotUsed)
                        {
                            DefaultRange = TestRange;
                        }
                        RangeFound = true;
                        break;
                    }
                    else
                    {
                        if ((ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NetDevInUseByAnotherProc) ||
                            (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NetDevInUse))
                        {
                            System.Windows.Forms.MessageBox.Show(ConnectionConflict, "Device In Use");
                            break;
                        }
                    }
                }
            }
            return(RangeFound);
        }
Exemplo n.º 2
0
        private bool TestInputRanges(out MccDaq.Range DefaultRange)
        {
            short dataValue;
            int   dataHRValue, Options, index;

            MccDaq.ErrorInfo ULStat;
            MccDaq.Range     TestRange;
            bool             RangeFound = false;
            string           ConnectionConflict;

            ConnectionConflict = "This network device is in use by another process or user." +
                                 System.Environment.NewLine + System.Environment.NewLine +
                                 "Check for other users on the network and close any applications " +
                                 System.Environment.NewLine +
                                 "(such as Instacal) that may be accessing the network device.";

            ValidRanges  = new MccDaq.Range[49];
            DefaultRange = MccDaq.Range.NotUsed;
            TestRange    = MccDaq.Range.NotUsed;
            Options      = 0;
            index        = 0;
            foreach (int i in Enum.GetValues(TestRange.GetType()))
            {
                TestRange = (MccDaq.Range)i;
                if (ADRes > 16)
                {
                    ULStat = TestBoard.AIn32(0, TestRange, out dataHRValue, Options);
                }
                else
                {
                    ULStat = TestBoard.AIn(0, TestRange, out dataValue);
                }
                if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                {
                    if (DefaultRange == MccDaq.Range.NotUsed)
                    {
                        DefaultRange = TestRange;
                    }
                    ValidRanges.SetValue(TestRange, index);
                    index      = index + 1;
                    RangeFound = true;
                }
                else
                {
                    if ((ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NetDevInUseByAnotherProc) ||
                        (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NetDevInUse))
                    {
                        System.Windows.Forms.MessageBox.Show(ConnectionConflict, "Device In Use");
                        break;
                    }
                }
            }
            Array.Resize(ref ValidRanges, index);
            return(RangeFound);
        }
        private bool TestOutputRanges(out MccDaq.Range DefaultRange)
        {
            short dataValue = 0;

            MccDaq.ErrorInfo ULStat;
            MccDaq.Range     TestRange;
            bool             RangeFound = false;
            int configVal;

            DefaultRange = MccDaq.Range.NotUsed;
            TestRange    = (MccDaq.Range)(-5);
            ULStat       = TestBoard.AOut(0, TestRange, dataValue);
            if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                ULStat = TestBoard.GetConfig(2, 0, 114, out configVal);
                if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                {
                    DefaultRange = (MccDaq.Range)configVal;
                    RangeFound   = true;
                }
            }
            else
            {
                TestRange = MccDaq.Range.NotUsed;
                foreach (int i in Enum.GetValues(TestRange.GetType()))
                {
                    TestRange = (MccDaq.Range)i;
                    ULStat    = TestBoard.AOut(0, TestRange, dataValue);
                    if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                    {
                        if (DefaultRange == MccDaq.Range.NotUsed)
                        {
                            DefaultRange = TestRange;
                        }
                        RangeFound = true;
                        break;
                    }
                }
            }
            return(RangeFound);
        }
        private bool TestInputRanges(out MccDaq.Range DefaultRange)
        {
            short dataValue;
            int   dataHRValue, Options, index;

            MccDaq.ErrorInfo ULStat;
            MccDaq.Range     TestRange;
            bool             RangeFound = false;

            ValidRanges  = new MccDaq.Range[49];
            DefaultRange = MccDaq.Range.NotUsed;
            TestRange    = MccDaq.Range.NotUsed;
            Options      = 0;
            index        = 0;
            foreach (int i in Enum.GetValues(TestRange.GetType()))
            {
                TestRange = (MccDaq.Range)i;
                if (ADRes > 16)
                {
                    ULStat = TestBoard.AIn32(0, TestRange, out dataHRValue, Options);
                }
                else
                {
                    ULStat = TestBoard.AIn(0, TestRange, out dataValue);
                }
                if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
                {
                    if (DefaultRange == MccDaq.Range.NotUsed)
                    {
                        DefaultRange = TestRange;
                    }
                    ValidRanges.SetValue(TestRange, index);
                    index      = index + 1;
                    RangeFound = true;
                }
            }
            Array.Resize(ref ValidRanges, index);
            return(RangeFound);
        }