Example #1
0
        /// <summary>
        /// Запуск отладчика
        /// </summary>
        public void Start()
        {
            if (this.EngineStatus != DebuggerEngineStatus.Stopped)
            {
                throw new Exception("Отладчик уже запущен");
            }
            SerialPort485 p = new SerialPort485(this.Parameters.PortName, this.Parameters.BaudRate, this.Parameters.ProcessorType);

            if (this.Parameters.ProcessorType == ProcessorType.AT89C51ED2)
            {
                this._BufferSize = 8;
                this._serialPort = new Relkon37SerialPort(p);
            }
            else if (this.Parameters.ProcessorType == ProcessorType.MB90F347)
            {
                this._serialPort = new Relkon4SerialPort(p);
            }
            else
            {
                throw new Exception("Процессор " + this.Parameters.ProcessorType + " не поддерживается");
            }
            this._serialPort.ControllerAddress = this.Parameters.ControllerNumber;
            this.asyncOp = AsyncOperationManager.CreateOperation(null);
            WorkingDelegate worker = new WorkingDelegate(this.Questioning_TH);

            worker.BeginInvoke(port, this.Parameters.ProcessorType, null, null);
        }
Example #2
0
        /// <summary>
        /// Читает размер буффера с контроллера на базе процессора MB90F347
        /// </summary>
        /// <param name="port">Порт, через который осуществляется чтение; должен быть уже открыт</param>
        private int ReadMB90F347BufferSize(Relkon37SerialPort port)
        {
            byte[] addresses = { 340, 344 };
            int    res       = int.MaxValue;

            for (int i = 0; i < 2; i++)
            {
                byte[] response = port.ReadEEPROM(addresses[i], 2);
                if (this.Parameters.InverseByteOrder)
                {
                    Array.Reverse(response);
                }
                int SRX = AppliedMath.BytesToInt(response);
                response = port.ReadEEPROM(addresses[i] + 4, 2);
                if (this.InverseByteOrder)
                {
                    Array.Reverse(response);
                }
                NRX = AppliedMath.BytesToInt(response);
                res = Math.Min(res, NRX - SRX + 1);
            }
            return(res);
        }