Ejemplo n.º 1
0
        public void Initialize(string comPort)
        {
            mes     = new SerialMessenger(comPort, "\n");
            ComPort = comPort;

            //Serial Port Options
            if (mes.Port.IsOpen)
            {
                mes.Port.Close();
            }
            mes.Port.PortName               = comPort;
            mes.Port.BaudRate               = 19200;
            mes.Port.Parity                 = Parity.None;
            mes.Port.DataBits               = 8;
            mes.Port.StopBits               = StopBits.One;
            mes.Port.RtsEnable              = false;
            mes.Port.DtrEnable              = false;
            mes.Port.Handshake              = Handshake.None;
            mes.Port.ReadTimeout            = 222;
            mes.Port.DiscardNull            = true;
            mes.Port.ReceivedBytesThreshold = 1;
            mes.Start();

            //Clear the line
            mes.SendMessage(0x03, (resp) => { });
        }
Ejemplo n.º 2
0
        public void Initialize(string com)
        {
            mes     = new SerialMessenger(com, "\n");
            ComPort = com;

            //Serial Port Options
            if (mes.Port.IsOpen)
            {
                mes.Port.Close();
            }
            mes.Port.PortName               = com;
            mes.Port.BaudRate               = 19200;
            mes.Port.Parity                 = Parity.None;
            mes.Port.DataBits               = 8;
            mes.Port.StopBits               = StopBits.One;
            mes.Port.RtsEnable              = false;
            mes.Port.DtrEnable              = false;
            mes.Port.Handshake              = Handshake.None;
            mes.Port.ReadTimeout            = 222;
            mes.Port.WriteTimeout           = 222;
            mes.Port.DiscardNull            = true;
            mes.Port.ReceivedBytesThreshold = 1;
            mes.Start();

            GetCurrentDepthMM();
        }