Beispiel #1
0
 public bool Open(string com)
 {
     try
     {
         _ComDataSplitcs             = new ComDataSplitcs();
         _ComDataSplitcs._SplitData += new ComDataSplitcs.SplitData(_ComDataSplitcs__SplitData);
         Comm          = new SerialPort();
         Comm.PortName = com;
         Comm.BaudRate = 115200;
         Comm.DataBits = 8;
         Comm.StopBits = (System.IO.Ports.StopBits) 1;
         Comm.Parity   = (System.IO.Ports.Parity) 0;
         Comm.Open();
         Start();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Beispiel #2
0
        public bool Open(string com)
        {
            try
            {
                _ComDataSplitcs = new ComDataSplitcs();
                _ComDataSplitcs._SplitData += new ComDataSplitcs.SplitData(_ComDataSplitcs__SplitData);
                Comm = new SerialPort();
                Comm.PortName = com;
                Comm.BaudRate = 115200;
                Comm.DataBits = 8;
                Comm.StopBits = (System.IO.Ports.StopBits)1;
                Comm.Parity = (System.IO.Ports.Parity)0;
                Comm.Open();
                Start();
                return true;

            }
            catch (Exception ex)
            {
                return false;
            }
        }