예제 #1
0
        private void DeviceConnect()
        {
            oda = new ODA(ODA_, ini.Read("POWER1", "PortName", ""), Convert.ToInt32(ini.Read("POWER1", "BaudRate", "9600")));
            oda.Open();
            oda.IDN();
            DateTime NowTime  = DateTime.Now;
            TimeSpan WaitTime = new TimeSpan(0, 0, 0, 0, 500);
            DateTime EndTime  = NowTime.Add(WaitTime);

            while (EndTime >= NowTime)
            {
                Application.DoEvents();
                if (oda.Connect)
                {
                    break;
                }
                NowTime = DateTime.Now;
            }

            sorensen = new SorensenXG(Sorensen_, ini.Read("POWER2", "PortName", ""), Convert.ToInt32(ini.Read("POWER2", "BaudRate", "9600")));
            sorensen.Open();
            sorensen.ADR();
            sorensen.IDN();
            NowTime = DateTime.Now;
            EndTime = NowTime.Add(WaitTime);
            while (EndTime >= NowTime)
            {
                Application.DoEvents();
                if (sorensen.Connect)
                {
                    break;
                }
                NowTime = DateTime.Now;
            }

            lamda = new TDKLamdaGENH(Lamda_, ini.Read("POWER3", "PortName", ""), Convert.ToInt32(ini.Read("POWER3", "BaudRate", "9600")));
            lamda.Open();
            lamda.ADR();
            lamda.IDN();
            NowTime = DateTime.Now;
            EndTime = NowTime.Add(WaitTime);
            while (EndTime >= NowTime)
            {
                Application.DoEvents();
                if (lamda.Connect)
                {
                    break;
                }
                NowTime = DateTime.Now;
            }
        }
예제 #2
0
 private void DeviceConnect()
 {
     oda      = new ODA();
     sorenson = new SorensenXG();
     lamda    = new TDKLamdaGENH();
 }