Esempio n. 1
0
 public SerialCom(String comport, int baud)
 {
     try{
         sPort = new SerialPort(comport, baud);
         sPort.Open();
         //sPort.DataRecived+=new SerialDataReceivedEventHandler(dataRecive);
         myTimer.Tick    += new EventHandler(Scanner);
         myTimer.Interval = 100;
         myTimer.Enabled  = true;
         RS232.onConnect();
     }
     catch (Exception ex)
     {
         //	MessageBox.Show("com error:"+ex.Message);
         RS232.onDisconnect();
     }
 }
Esempio n. 2
0
 public void closeConnection()
 {
     sPort.Close();
     myTimer.Dispose();
     RS232.onDisconnect();
 }