Ejemplo n.º 1
0
        private void DAQConfig()
        {
            err = DASK.AI_9221_Config(cardRegNumber, ConfigCtrl, TrigCtrl, true);
            if (err < 0)
            {
                MessageBox.Show("config");
            }

            /*Set Scan and Sampling Rate*/
            ; err = DASK.AI_9221_CounterInterval(cardRegNumber, ScanIntrv, SampIntrv);
            if (err < 0)
            {
                MessageBox.Show("AI_9222_CounterInterval");
            }

            /*Enable Double Buffer Mode*/
            err = DASK.AI_AsyncDblBufferMode(cardRegNumber, true);
            if (err < 0)
            {
                MessageBox.Show("AI_AsyncDblBufferMode");
            }

            /*Setup Buffer for AI DMA Transfer*/
            err = DASK.AI_ContBufferSetup(cardRegNumber, _ptr[0], AI_TotalReadCount, out _bufferId[0]);
            if (err < 0)
            {
                MessageBox.Show("AI_ContBufferSetup");
            }
            err = DASK.AI_ContBufferSetup(cardRegNumber, _ptr[1], AI_TotalReadCount, out _bufferId[1]);
            if (err < 0)
            {
                MessageBox.Show("AI_ContBufferSetup");
            }

            err = DASK.AI_EventCallBack(cardRegNumber, 1 /*add*/, DASK.DBEvent /*EventType*/, ai_buf_ready_cbdel);
            if (err < 0)
            {
                MessageBox.Show("AI_EventCallBack");
            }

            err = DASK.AI_ContScanChannels(cardRegNumber, (ushort)(Channel - 1), AdRange, _bufferId, AI_TotalReadCount, 0 /*Ignore*/, DASK.ASYNCH_OP);
            if (err < 0)
            {
                MessageBox.Show("AI_ContScanChannels");
            }
        }