示例#1
0
文件: ULCT01.cs 项目: otoauler/sdkpub
        MccDaq.CounterRegister RegName = MccDaq.CounterRegister.LoadReg1; //  register name of counter 1

        #endregion Fields

        #region Constructors

        public frmCountTest()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
            //     MccDaq.ErrorHandling.StopAll   :if an error is encountered, the program will stop
            MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);

            // Create a new MccBoard object for Board 0
            DaqBoard = new MccDaq.MccBoard(0);

            //  Configure the counter for desired operation
            //   Parameters:
            //     CounterNum :the counter to be setup
            //     Config     :the operation mode of counter to be configured
            MccDaq.C8254Mode Config = MccDaq.C8254Mode.HighOnLastCount;
            ULStat = DaqBoard.C8254Config(CounterNum, Config);

            //  Send a starting value to the counter with MccDaq.MccBoard.CLoad()
            //   Parameters:
            //     RegName    :the register for loading the counter with the starting value
            //     LoadValue  :the starting value to place in the counter
            int LoadValue = 1000;
            ULStat = DaqBoard.CLoad(RegName, LoadValue);

            lblCountLoaded.Text = "Counter starting value loaded:";
            lblShowLoadVal.Text = LoadValue.ToString("0");
        }
示例#2
0
        MccDaq.CounterRegister RegName = MccDaq.CounterRegister.LoadReg1; //  register name of counter 1


        public frmCountTest()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();


            //  Initiate error handling
            //   activating error handling will trap errors like
            //   bad channel numbers and non-configured conditions.
            //   Parameters:
            //     MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
            //     MccDaq.ErrorHandling.StopAll   :if an error is encountered, the program will stop
            MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);


            // Create a new MccBoard object for Board 0
            DaqBoard = new MccDaq.MccBoard(0);


            //  Configure the counter for desired operation
            //   Parameters:
            //     CounterNum :the counter to be setup
            //     Config     :the operation mode of counter to be configured
            MccDaq.C8254Mode Config = MccDaq.C8254Mode.HighOnLastCount;
            ULStat = DaqBoard.C8254Config(CounterNum, Config);


            //  Send a starting value to the counter with MccDaq.MccBoard.CLoad()
            //   Parameters:
            //     RegName    :the register for loading the counter with the starting value
            //     LoadValue  :the starting value to place in the counter
            int LoadValue = 1000;

            ULStat = DaqBoard.CLoad(RegName, LoadValue);

            lblCountLoaded.Text = "Counter starting value loaded:";
            lblShowLoadVal.Text = LoadValue.ToString("0");
        }
示例#3
0
        private void frmCountTest_Load(object sender, EventArgs e)
        {
            InitUL();
            NumCtrs = CtrProps.FindCountersOfType(DaqBoard, CounterType, out CounterNum);
            if (NumCtrs == 0)
            {
                lblNoteFreqIn.Text = "Board " + DaqBoard.BoardNum.ToString() +
                                     " has no 8254 counters.";
            }
            else
            {
                //  Configure the counter for desired operation
                //   Parameters:
                //     CounterNum :the counter to be setup
                //     Config     :the operation mode of counter to be configured
                MccDaq.C8254Mode Config = MccDaq.C8254Mode.HighOnLastCount;
                MccDaq.ErrorInfo ULStat = DaqBoard.C8254Config(CounterNum, Config);

                //  Send a starting value to the counter with MccDaq.MccBoard.CLoad()
                //   Parameters:
                //     RegName    :the register for loading the counter with the starting value
                //     LoadValue  :the starting value to place in the counter
                int LoadValue = 1000;

                RegName = (CounterRegister)Enum.Parse(typeof(CounterRegister), CounterNum.ToString());
                ULStat  = DaqBoard.CLoad(RegName, LoadValue);

                lblNoteFreqIn.Text =
                    "NOTE: There must be a TTL frequency at the counter " +
                    CounterNum.ToString() + " input on board " +
                    DaqBoard.BoardNum.ToString() + ".";
                this.lblCountRead.Text = "Value read from counter " + CounterNum.ToString() + ":";
                lblCountLoaded.Text    = "Counter starting value loaded:";
                lblShowLoadVal.Text    = LoadValue.ToString("0");
                tmrReadCount.Enabled   = true;
            }
        }