示例#1
0
        private void cmdStartBgnd_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            int   CurIndex;
            int   CurCount;
            short Status;

            MccDaq.ErrorInfo ULStat;
            int CBRate;

            MccDaq.ScanOptions Options;

            MccDaq.DigitalPortDirection Direction;
            MccDaq.DigitalPortType      PortNum;

            cmdStartBgnd.Enabled   = false;
            cmdStartBgnd.Visible   = false;
            cmdStopConvert.Enabled = true;
            cmdStopConvert.Visible = true;
            cmdQuit.Enabled        = false;
            UserTerm = 0;             // initialize user terminate flag

            //FirstPortA is treated as a 16-bit port; therefore FirtstPortA and FirstPortB must be configured for digital output
            PortNum   = MccDaq.DigitalPortType.FirstPortA;
            Direction = MccDaq.DigitalPortDirection.DigitalOut;
            ULStat    = DaqBoard.DConfigPort(PortNum, Direction);

            PortNum   = MccDaq.DigitalPortType.FirstPortB;
            Direction = MccDaq.DigitalPortDirection.DigitalOut;
            ULStat    = DaqBoard.DConfigPort(PortNum, Direction);

            // Collect the values with cbDaqInScan()
            //  Parameters:
            //    BoardNum        :the number used by CB.CFG to describe this board
            //    ChanArray[]     :array of channel values
            //    ChanTypeArray[] : array of channel types
            //    GainArray[]     :array of gain values
            //    ChansCount      :the number of elements in the arrays (0=disable queue)
            //    Count           :the total number of A/D samples to collect
            //    CBRate          :sample rate in samples per second
            //    ADData[]        :the array for the collected data values
            //    Options         :data collection options

            Options = MccDaq.ScanOptions.Background | MccDaq.ScanOptions.Continuous | MccDaq.ScanOptions.NonStreamedIO;
            CBRate  = 1000;            // Generate data at 1000 Hz

            ULStat = DaqBoard.DaqOutScan(ChanArray, ChanTypeArray, GainArray, ChanCount, ref CBRate, Count, MemHandle, Options);

            ULStat = DaqBoard.GetStatus(out Status, out CurCount, out CurIndex, MccDaq.FunctionType.DaqoFunction);

            if (Status == MccDaq.MccBoard.Running)
            {
                lblShowStat.Text  = "Running";
                lblShowCount.Text = CurCount.ToString("D");
                lblShowIndex.Text = CurIndex.ToString("D");
            }

            tmrCheckStatus.Enabled = true;
        }
示例#2
0
        public frmEventDisplay()
        {
            //
            // Required for Windows Form Designer support
            //
            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);


            //configure the digital port for input
            ULStat = DaqBoard.DConfigPort(this._digPort, MccDaq.DigitalPortDirection.DigitalIn);

            //store a reference to this instance in the TUserData struct
            _userData.ThisObj = this;

            //get a pointer to the TUserData struct to pass to EnableEvent
            _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData));
            Marshal.StructureToPtr(_userData, _ptrUserData, false);

            //get pointers to the event handlers to be called...
            _ptrMyCallback = new MccDaq.EventCallback(MyCallback);
        }
示例#3
0
        private void cmdStartBgnd_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            int   CurIndex;
            int   CurCount;
            short Status;

            MccDaq.ErrorInfo ULStat;
            int Rate;

            MccDaq.ScanOptions Options;
            int Count;
            int PretrigCount;

            cmdStartBgnd.Enabled   = false;
            cmdStartBgnd.Visible   = false;
            cmdStopConvert.Enabled = true;
            cmdStopConvert.Visible = true;
            cmdQuit.Enabled        = false;
            UserTerm = 0;             // initialize user terminate flag

            MccDaq.DigitalPortDirection Direction;
            MccDaq.DigitalPortType      PortNum;

            //configure FirstPortA for digital input
            PortNum   = (MccDaq.DigitalPortType)ChanArray[1];
            Direction = MccDaq.DigitalPortDirection.DigitalIn;
            ULStat    = DaqBoard.DConfigPort(PortNum, Direction);

            // Collect the values with cbDaqInScan()
            //  Parameters:
            //    BoardNum        :the number used by CB.CFG to describe this board
            //    ChanArray[]     :array of channel values
            //    ChanTypeArray[] : array of channel types
            //    GainArray[]     :array of gain values
            //    ChansCount        :the number of elements in the arrays (0=disable queue)
            //    PretrigCount    :number of pre-trigger A/D samples to collect
            //    Count         :the total number of A/D samples to collect
            //    Rate          :sample rate in samples per second
            //    ADData[]        :the array for the collected data values
            //    Options          :data collection options

            PretrigCount = 0;
            Count        = NumElements; // Number of data points to collect
            Options      = MccDaq.ScanOptions.ConvertData | MccDaq.ScanOptions.Background | MccDaq.ScanOptions.Continuous;
            Rate         = 100;         // Acquire data at 100 Hz

            ULStat = DaqBoard.DaqInScan(ChanArray, ChanTypeArray, GainArray, ChanCount, ref Rate, ref PretrigCount, ref Count, MemHandle, Options);

            ULStat = DaqBoard.GetStatus(out Status, out CurCount, out CurIndex, MccDaq.FunctionType.DaqiFunction);

            if (Status == MccDaq.MccBoard.Running)
            {
                lblShowStat.Text  = "Running";
                lblShowCount.Text = CurCount.ToString("D");
                lblShowIndex.Text = CurIndex.ToString("D");
            }

            tmrCheckStatus.Enabled = true;
        }
示例#4
0
        public Probador()
        {
            InitializeComponent();

            MccDaq.ErrorInfo ULstat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopFatal);

            interfaz = new MccDaq.MccBoard(0);

            ULstat = interfaz.DConfigPort(puerto, direccion);
        }
示例#5
0
        private void frmEventDisplay_Load(object sender, EventArgs e)
        {
            MccDaq.ErrorInfo ULStat;
            int PortType, EventMask;

            InitUL();

            //determine if digital port exists, its capabilities, etc
            PortType = clsDigitalIO.PORTIN;
            NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility,
                                                out PortNum, out NumBits, out FirstBit);
            EventMask = clsEventSupport.INTEVENT;
            NumEvents = SupportedEvents.FindEventsOfType(DaqBoard, EventMask);
            if (NumPorts == 0)
            {
                lblInstruct.Text = "There are no compatible digital ports on board " +
                                   DaqBoard.BoardNum.ToString() + ".";
            }
            else if (!(EventMask == NumEvents))
            {
                this.lblInstruct.Text = "Board " +
                                        DaqBoard.BoardNum.ToString() +
                                        " doesn't support the specified event types.";
            }
            else
            {
                // if programmable, set direction of port to input
                // configure the first port for digital input
                //  Parameters:
                //    PortNum        :the input port
                //    Direction      :sets the port for input or output

                if (ProgAbility == clsDigitalIO.PROGPORT)
                {
                    Direction = MccDaq.DigitalPortDirection.DigitalIn;
                    ULStat    = DaqBoard.DConfigPort(PortNum, Direction);
                }
                PortName         = PortNum.ToString();
                lblInstruct.Text = "Trigger events by supplying a TTL " +
                                   "pulse on the interrupt input of board " +
                                   DaqBoard.BoardNum.ToString() + ". A read of digital inputs on "
                                   + PortName + " is done every " + _updateSize.ToString()
                                   + " interrupts.";
                this.cmdDisableEvent.Enabled = true;
                this.cmdEnableEvent.Enabled  = true;
            }
        }
示例#6
0
 private void btnInterfaz_Click(object sender, EventArgs e)
 {
     MccDaq.ErrorInfo ULstat;
     interfaz = new MccDaq.MccBoard(Convert.ToInt16(txtInterfaz.Text));
     ULstat = interfaz.DConfigPort(puerto, direccion);
 }
示例#7
0
 public IncomingData()
 {   //USB Ports for trigger
     USB1.DConfigPort(MccDaq.DigitalPortType.FifthPortA, MccDaq.DigitalPortDirection.DigitalIn);
     USB1.DConfigPort(MccDaq.DigitalPortType.FifthPortA, MccDaq.DigitalPortDirection.DigitalIn);
 }
        //~TestFixtureDAQ()
        //{

        //    ResetPort();
        //}

        /*
         * this function is used configure digital port as input or output
         * Outbut will be read from this set digital port
         * This function is called from ReadStemVotlageFromDaq
         */
        public void TurnOnVoltageOn()
        {
            MccDaq.ErrorInfo ULStat;

            ULStat = DaqBoard.DConfigPort(MccDaq.DigitalPortType.FirstPortA, MccDaq.DigitalPortDirection.DigitalIn);
            ULStat = DaqBoard.DBitOut(MccDaq.DigitalPortType.FirstPortA, 1, MccDaq.DigitalLogicState.High);
        }
示例#9
0
        private void cmdStartBgnd_Click(System.Object eventSender, System.EventArgs eventArgs)
        {
            int   CurIndex;
            int   CurCount;
            short Status;

            MccDaq.ErrorInfo ULStat;
            int    CBRate;
            object Options;
            int    CBCount;
            int    PretrigCount;

            MccDaq.TriggerSource      TrigSource;
            MccDaq.TriggerSensitivity TrigSense;
            int TrigChan;

            MccDaq.ChannelType ChanType;
            MccDaq.Range       Gain;
            float Variance;
            float Level;

            MccDaq.TriggerEvent TrigEvent;

            int Direction;
            int PortNum;

            cmdStartBgnd.Enabled   = false;
            cmdStartBgnd.Visible   = false;
            cmdStopConvert.Enabled = true;
            cmdStopConvert.Visible = true;
            cmdQuit.Enabled        = false;
            UserTerm = 0;             // initialize user terminate flag

            lblADData[0].Text = "";
            lblADData[1].Text = "";
            lblADData[2].Text = "";

            //configure FirstPortA for digital input
            PortNum   = ChanArray[1];
            Direction = System.Convert.ToInt32(MccDaq.DigitalPortDirection.DigitalIn);
            ULStat    = DaqBoard.DConfigPort((MccDaq.DigitalPortType)PortNum, (MccDaq.DigitalPortDirection)Direction);


            //Set Triggers
            //Parameters:
            //BoardNum    :the number used by CB.CFG to describe this board
            //TrigSource  :trigger source
            //TrigSense   :trigger sensitivity
            //TrigChan    :trigger channel
            //ChanType    :trigger channel type
            //Gain        :trigger channel gain
            //Level       :trigger Level
            //Variance    :trigger Variance
            //TrigEvent   :trigger event type

            //Start trigger settings
            //     AD conversions are enabled when analog channel 0 makes a transition from below 2 V to above.*/
            TrigSource = MccDaq.TriggerSource.TrigAnalogSW;
            TrigSense  = MccDaq.TriggerSensitivity.RisingEdge;
            TrigChan   = ChanArray[0];
            ChanType   = ChanTypeArray[0];
            Gain       = GainArray[0];
            Level      = 2;
            Variance   = 0;
            TrigEvent  = MccDaq.TriggerEvent.Start;

            //Set start trigger
            ULStat = DaqBoard.DaqSetTrigger(TrigSource, TrigSense, TrigChan, ChanType, Gain, Level, Variance, TrigEvent);

            //Stop trigger settings
            //  AD conversions are terminated when counter 0 reaches 100 counts.*/
            TrigSource = MccDaq.TriggerSource.TrigCounter;
            TrigSense  = MccDaq.TriggerSensitivity.AboveLevel;
            TrigChan   = ChanArray[2];
            ChanType   = ChanTypeArray[2];
            Gain       = GainArray[2];
            Level      = 100;
            Variance   = 0;
            TrigEvent  = MccDaq.TriggerEvent.Stop;

            //Set stop trigger
            ULStat = DaqBoard.DaqSetTrigger(TrigSource, TrigSense, TrigChan, ChanType, Gain, Level, Variance, TrigEvent);

            // Collect the values with cbDaqInScan()
            //  Parameters:
            //    BoardNum        :the number used by CB.CFG to describe this board
            //    ChanArray[]     :array of channel values
            //    ChanTypeArray[] : array of channel types
            //    GainArra[]      :array of gain values
            //    ChansCount      :the number of elements in the arrays (0=disable queue)
            //    PretrigCount    :number of pre-trigger A/D samples to collect
            //    CBCount         :the total number of A/D samples to collect
            //    CBRate          :sample rate in samples per second
            //    ADData[]        :the array for the collected data values
            //    Options         :data collection options

            PretrigCount = 0;
            CBCount      = NumElements;        // Number of data points to collect

            Options = MccDaq.ScanOptions.ConvertData | MccDaq.ScanOptions.Background | MccDaq.ScanOptions.Continuous | MccDaq.ScanOptions.ExtTrigger;
            CBRate  = 100;            // Acquire data at 100 Hz

            ULStat = DaqBoard.DaqInScan(ChanArray, ChanTypeArray, GainArray, ChanCount, ref CBRate, ref PretrigCount, ref CBCount, MemHandle, (MccDaq.ScanOptions)Options);

            ULStat = DaqBoard.GetStatus(out Status, out CurCount, out CurIndex, MccDaq.FunctionType.DaqiFunction);

            if (Status == MccDaq.MccBoard.Running)
            {
                lblShowStartTrig.Text = "Waiting for trigger...";
                lblShowStopTrig.Text  = "";
                lblShowStat.Text      = "Running";
                lblShowCount.Text     = CurCount.ToString("D");
                lblShowIndex.Text     = CurIndex.ToString("D");
            }

            tmrCheckStatus.Enabled = true;
        }