Example #1
0
        public void Start(uint HandleMsgLoop)
        {
            finished_count = 0;

            foreach (DEVICEID id in devices)
            {
                //End, 500, set num events
                HANDLE_RETURN_VALUES = aio.SetAiEvent(id, HandleMsgLoop, (int)(CaioConst.AIE_END | CaioConst.AIE_DATA_NUM | CaioConst.AIE_DATA_TSF));
            }

            foreach (DEVICEID id in devices)
            {
                HANDLE_RETURN_VALUES = aio.StartAi(id);
            }
        }
Example #2
0
        //ロギング開始
        private void loggingStartBtn_Click(object sender, EventArgs e)
        {
            Form1 mainForm = (Form1)this.Owner;

            //ラベルで動作を変える
            if (loggingStartBtn.Text == "開始")
            {
                resetAio();
                int aioStartLogging = aio.StartAi(devId);
                startTime = DateTime.Now;
                if (aioStartLogging != 0)
                {
                    statusMsg(aioStartLogging, null);
                    return;
                }
                aioConvertStarted = true;
                statusMsg(0, "変換を開始しました");
                loggingStartBtn.Text = "取得中...";
                devMemoryTimer.Start();
                mainForm.logFormData(true);
            }
            else
            {
                devMemoryTimer.Stop();
                int aioStopLogging = aio.StopAi(devId);
                if (aioStopLogging != 0)
                {
                    statusMsg(aioStopLogging, null);
                    return;
                }
                aioConvertStarted    = false;
                loggingStartBtn.Text = "開始";
                statusMsg(0, "変換を停止しました");
                mainForm.logFormData(false);
            }
            //mainForm.statusLabel.Text = "test";
        }
Example #3
0
        public AIO121602()
        {
            ThicknessOffsets = new float[] { 0, 0, 0, 0, 0, 0, 0, 0 };
            System.Timers.Timer _timeout = new System.Timers.Timer(5000);
            bool isTimeout = false, isInitEnd = false;

            for (int i = 0; i < _avrs.Length; i++)
            {
                _avrs[i] = new MoveAverage(4);
            }

            _timeout.Elapsed += ((object sender, System.Timers.ElapsedEventArgs e) => {
                _timeout.Stop();
                isTimeout = true;
            });
            _timeout.Start();

            Task.Run(() => {
                LastErrorNo = _aio.Init(ITEM_NAME, out _aioId);
                isInitEnd   = true;
            });

            while (!isTimeout && !isInitEnd)
            {
                Thread.Sleep(100);
            }
            _timeout.Stop();
            if (isTimeout)
            {
                LastErrorNo = -1;
                return;
            }

            LastErrorNo = _aio.ResetDevice(_aioId);
            if (LastErrorNo != 0)
            {
                return;
            }

            LastErrorNo = _aio.SetAiStopTrigger(_aioId, 4);
            if (LastErrorNo != 0)
            {
                return;
            }

            LastErrorNo = _aio.SetAiChannels(_aioId, 14);
            if (LastErrorNo != 0)
            {
                return;
            }
            LastErrorNo = _aio.SetAiRangeAll(_aioId, (short)CaioConst.PM5);
            if (LastErrorNo != 0)
            {
                return;
            }
            LastErrorNo = _aio.SetAiTransferMode(_aioId, 0);                                    // デバイスバッファモード
            if (LastErrorNo != 0)
            {
                return;
            }
            LastErrorNo = _aio.SetAiMemoryType(_aioId, 0);                                              // MemoryFIFOモード
            if (LastErrorNo != 0)
            {
                return;
            }
            LastErrorNo = _aio.SetAiClockType(_aioId, 0);
            if (LastErrorNo != 0)
            {
                return;
            }
            LastErrorNo = _aio.SetAiSamplingClock(_aioId, 3000);                    // 1msサンプリング
//			LastErrorNo = _aio.SetAiSamplingClock( _aioId, 50000 );      // 1msサンプリング
            if (LastErrorNo != 0)
            {
                return;
            }

            ThicknessOneSheetQue = new Queue <ThicknessData[][]>();

            _aio.StartAi(_aioId);
            _interval          = new System.Timers.Timer();
            _interval.Interval = 100;
            _interval.Elapsed += _interval_Elapsed;
            _interval.Start();
        }