Exemple #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.BackColor = MainForm.sysBackColor;

            // Layout 设置
            LayoutInit();

            timerLoadData.Start(); // 加载日志文件

            //
            serialWireless = new SerialWireless("COM3", 19200);
            try
            {
                serialWireless.Open();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("无线通信串口打开失败");
            }
            finally { }

            //
            serialManual = new SerialManual("COM5", 19200);
            try
            {
                serialManual.Open();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("手动操作台串口打开失败");
            }
            finally { }
            serialTemp = new SerialTemp("COM8", 9600);
            try
            {
                serialTemp.Open();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("温度串口打开失败");
            }
            finally { }
        }
Exemple #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.BackColor = MainForm.sysBackColor;

            // Layout 设置
            LayoutInit();

            timerLoadData.Start(); // 加载日志文件

            //
            serialWireless = new SerialWireless("COM5", 19200);
            try
            {
                serialWireless.Open();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("无线通信串口打开失败");
            }
            finally { }

            //
            serialManual = new SerialManual("COM6", 19200);
            try
            {
                serialManual.Open();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("手动操作台串口打开失败");
            }
            finally { }
            modbus_TCP = new modbus_TCP("192.168.1.10", 3000);
            try
            {
                modbus_TCP.Connect();// 打开串口
            }
            catch (Exception e1)
            {
                MessageBox.Show("手动操作台串口打开失败");
            }
            finally { }
        }