Ejemplo n.º 1
0
        void ai_buf_ready_cbfunc()
        {
            aliveindex++;
            daqcontrol.result = USBDASK.UD_AI_AsyncDblBufferTransfer32(0, daqcontrol.airowdata);
            if (daqcontrol.result != USBDASK.NoError)
            {
                //this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_AsyncDblBufferTransfer32s(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            daqcontrol.result = USBDASK.UD_AI_ContVScale32(0, USBDASK.AD_B_10_V, 0 /*inType*/, daqcontrol.airowdata, daqcontrol.aivoltagedata, (int)(daqcontrol.allchanlength));
            if (daqcontrol.result != USBDASK.NoError)
            {
                //this.Cursor = Cursors.Default;
                MessageBox.Show("Falied to perform UD_AI_ContVScale32(), error: " + daqcontrol.result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            WriteChannelData();

            MethodInvoker mi = new MethodInvoker(this.UpdateUI);

            ushort OverrunFlag;

            USBDASK.UD_AI_AsyncDblBufferHandled(0);
            USBDASK.UD_AI_AsyncDblBufferOverrun(0, 0, out OverrunFlag);

            if (OverrunFlag == 1)
            {
                m_dwOverrunCnt = m_dwOverrunCnt + 1;
                USBDASK.UD_AI_AsyncDblBufferOverrun(0, 1, out OverrunFlag);
                this.BeginInvoke(mi, null);
            }
            if (aliveindex == 10)
            {
                aliveindex = 0;
            }
            this.BeginInvoke(mi, null);
        }