Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();
            _serial = new SerialPort3964r(false);
            myPort = SerialPort3964r.GetPortNames(); //Obtenir tous les ports COM valides
            for (int i = 0; i < myPort.Length;i++)
            {
                CbPort.Items.Add(myPort[i]);
            }

            this.CbBaud.Items.Add(600) ;      //Peuplement de la combobox avec les différents baud rates
            this.CbBaud.Items.Add(1200);
            this.CbBaud.Items.Add(4800);
            this.CbBaud.Items.Add(9600);
            this.CbBaud.Items.Add(14400);
            this.CbBaud.Items.Add(19200);
            this.CbBaud.Items.Add(38400);
            this.CbBaud.Items.Add(57600);
            this.CbBaud.Items.Add(115200);

            this.CbPort.SelectedIndex = 0;      //1er port COM par défaut
            this.CbBaud.SelectedIndex = 3;     //4ème baud rate par défaut

            _data = new byte[3];
            _dataR = new byte[10];
        }
        public BO_Commands()
        {
            this._data = new byte[3];

            try
            {
                _serial = new SerialPort3964r(false);
                _serial.ReadTimeout = 1000;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public MainForm()
        {
            InitializeComponent();
            try
            {
                _serial = new SerialPort3964r(false);
                _serial.PortName = "COM9";
                _serial.BaudRate = 9600;
                _serial.ReadTimeout = 1000;
                _serial.Open();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            _data = new byte[3];

            myThread = new Thread(new ThreadStart(ThreadLoop));
            myThread.Start();
        }