Пример #1
0
        private void onIdle()
        {
            IdleCounter.Inc();

            if (controller != null)
            {
                UpdateRegister();
                UpdateStackDisplay();

                IconBar.SetPC(controller.GetSCLineForPC(controller.GetPC()));

                lblFreqModel.Text          = FormatFreq((uint)controller.Frequency.Frequency);
                lblFreqView.Text           = FormatFreq((uint)IdleCounter.Frequency);
                lblRunTime.Text            = FormatRuntime(controller.GetRunTime());
                lblRegW.Text               = "0x" + string.Format("{0:X02}", controller.GetWRegister());
                lblRegPC.Text              = "0x" + string.Format("{0:X04}", controller.GetPC());
                lblQuartzFreq.Text         = FormatFreq(controller.EmulatedFrequency);
                btnSetQuartzFreq.IsEnabled = true;
                lblWatchDogTmr.Text        = string.Format("{0:000.000} %", controller.GetWatchDogPerc() * 100);
                chkbxWatchdog.IsEnabled    = true;
                chkbxWatchdog.IsChecked    = controller.IsWatchDogEnabled();

                regClock_0.UpdateUI(controller);
                regClock_1.UpdateUI(controller);
                regClock_2.UpdateUI(controller);
                regClock_3.UpdateUI(controller);

                regClock_0.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_1.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_2.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_3.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;

                rs232_link.Update(controller);
            }
            else
            {
                ClearRegister();
                ClearStackDisplay();

                IconBar.SetPC(0);

                lblFreqModel.Text          = FormatFreq(0);
                lblFreqView.Text           = FormatFreq(0);
                lblRunTime.Text            = FormatRuntime(0);
                lblRegW.Text               = "0x" + string.Format("{0:X02}", 0);
                lblRegPC.Text              = "0x" + string.Format("{0:X04}", 0);
                lblQuartzFreq.Text         = FormatFreq(0);
                btnSetQuartzFreq.IsEnabled = false;
                lblWatchDogTmr.Text        = string.Format("{0:000,000} %", 0);
                chkbxWatchdog.IsEnabled    = false;

                regClock_0.ResetUI();
                regClock_1.ResetUI();
                regClock_2.ResetUI();
                regClock_3.ResetUI();

                regClock_0.IsEnabled = false;
                regClock_1.IsEnabled = false;
                regClock_2.IsEnabled = false;
                regClock_3.IsEnabled = false;

                rs232_link.Update(controller);
            }

            txtCode.IsReadOnly = controller != null && controller.Mode != PICControllerMode.WAITING;
            CommandManager.InvalidateRequerySuggested();
        }