Beispiel #1
0
        private void Configuredaq()
        {
            daqcontrol.result = USBDASK.UD_AI_2405_Chan_Config(0, daqcontrol.Chconfig, daqcontrol.Chconfig, daqcontrol.Chconfig, daqcontrol.Chconfig);
            if (daqcontrol.result != USBDASK.NoError)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_2405_Chan_Config(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            daqcontrol.result = USBDASK.UD_AI_2405_Trig_Config(0, USBDASK.P2405_AI_CONVSRC_INT, USBDASK.UD_AI_TRGMOD_POST, 0, 0, 0, 0, 0);
            if (daqcontrol.result != USBDASK.NoError)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_2405_Trig_Config(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            daqcontrol.result = USBDASK.UD_AI_AsyncDblBufferMode(0, true);
            if (daqcontrol.result != USBDASK.NoError)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_AsyncDblBufferMode(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            daqcontrol.result = USBDASK.UD_AI_EventCallBack(0, 1 /*add*/, USBDASK.DBEvent /*EventType*/, ai_buf_ready_cbdel);
            if (daqcontrol.result != USBDASK.NoError)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_EventCallBack(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            daqcontrol.result = USBDASK.UD_AI_ContReadMultiChannels(0, (ushort)daqcontrol.numbchans, daqcontrol.ai_chans, daqcontrol.ai_chans_range, daqcontrol.airowdata, daqcontrol.allchanlength * 2, daqcontrol.samplerate, USBDASK.ASYNCH_OP);
            if (daqcontrol.result != USBDASK.NoError)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_ContReadMultiChannels(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            Time       = DateTime.Now;
            Timetofile = Time;
        }