Watchdog Label
This commit is contained in:
@ -30,6 +30,7 @@ import javafx.util.Callback;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static java.lang.Math.max;
|
import static java.lang.Math.max;
|
||||||
@ -121,20 +122,20 @@ public class Controller_Frontend {
|
|||||||
wakeUpFromSleep();
|
wakeUpFromSleep();
|
||||||
else
|
else
|
||||||
DataRegister.resetPC();
|
DataRegister.resetPC();
|
||||||
// Stage stoppedStage = new Stage();
|
Stage stoppedStage = new Stage();
|
||||||
// stoppedStage.setTitle("Programm unterbrochen!");
|
stoppedStage.setTitle("Programm unterbrochen!");
|
||||||
// VBox vbox = new VBox();
|
VBox vbox = new VBox();
|
||||||
// vbox.setAlignment(javafx.geometry.Pos.CENTER);
|
vbox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||||
// Label grundlabel = new Label("Grund: " + message);
|
Label grundlabel = new Label("Grund: " + message);
|
||||||
// grundlabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold;");
|
grundlabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold;");
|
||||||
// Label ueberlabel = new Label("Programm unterbrochen!");
|
Label ueberlabel = new Label("Programm unterbrochen!");
|
||||||
// vbox.getChildren().add(ueberlabel);
|
vbox.getChildren().add(ueberlabel);
|
||||||
// vbox.getChildren().add(grundlabel);
|
vbox.getChildren().add(grundlabel);
|
||||||
// VBox.setMargin(grundlabel, new javafx.geometry.Insets(10, 10, 10, 10));
|
VBox.setMargin(grundlabel, new javafx.geometry.Insets(10, 10, 10, 10));
|
||||||
// Scene scene = new Scene(vbox, 300, 90);
|
Scene scene = new Scene(vbox, 300, 90);
|
||||||
// stoppedStage.setAlwaysOnTop(true);
|
stoppedStage.setAlwaysOnTop(true);
|
||||||
// stoppedStage.setScene(scene);
|
stoppedStage.setScene(scene);
|
||||||
// stoppedStage.show();
|
stoppedStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sleep() {
|
public static void sleep() {
|
||||||
@ -263,8 +264,8 @@ public class Controller_Frontend {
|
|||||||
Stage stage = (Stage) stepintoButton.getScene().getWindow();
|
Stage stage = (Stage) stepintoButton.getScene().getWindow();
|
||||||
CreateWindow.refreshTable(stage);
|
CreateWindow.refreshTable(stage);
|
||||||
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||||
|
updateStack();
|
||||||
|
updateWatchdog();
|
||||||
long totalExecutionTime = Commands.getTotalExecutionTime();
|
long totalExecutionTime = Commands.getTotalExecutionTime();
|
||||||
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
|
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
|
||||||
}
|
}
|
||||||
@ -317,6 +318,7 @@ public class Controller_Frontend {
|
|||||||
IOPorts.setPORTfromUI(toggleButtonGroup);
|
IOPorts.setPORTfromUI(toggleButtonGroup);
|
||||||
} catch (NullPointerException ignored) {}
|
} catch (NullPointerException ignored) {}
|
||||||
}
|
}
|
||||||
|
wakeUpFromSleep();
|
||||||
breakpoints.clear();
|
breakpoints.clear();
|
||||||
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||||
Commands.resetTotalExecutionTime();
|
Commands.resetTotalExecutionTime();
|
||||||
@ -326,6 +328,7 @@ public class Controller_Frontend {
|
|||||||
read = ParseFile.parseDatei(fileAddress);
|
read = ParseFile.parseDatei(fileAddress);
|
||||||
prog = read [0];
|
prog = read [0];
|
||||||
ind = read[1];
|
ind = read[1];
|
||||||
|
updateStack();
|
||||||
System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
|
System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
|
||||||
displayLSTFileContent(selectedFile);
|
displayLSTFileContent(selectedFile);
|
||||||
markSelectedRow(0, "-fx-background-color: red; -fx-text-fill: white;");
|
markSelectedRow(0, "-fx-background-color: red; -fx-text-fill: white;");
|
||||||
@ -577,6 +580,31 @@ public class Controller_Frontend {
|
|||||||
public void toggleLEDs (ActionEvent actionEvent) {
|
public void toggleLEDs (ActionEvent actionEvent) {
|
||||||
IOPorts.setLEDs(new boolean[]{ledCheckA.isSelected(), ledCheckB.isSelected()});
|
IOPorts.setLEDs(new boolean[]{ledCheckA.isSelected(), ledCheckB.isSelected()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label stackIndex;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ListView<String> stackVisual;
|
||||||
|
|
||||||
|
private static String format (String s) {
|
||||||
|
return (s.length() == 1) ? "0" + s : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStack (){
|
||||||
|
stackIndex.setText("Stack-Pointer: " + ProgramStack.getStackPointer());
|
||||||
|
ObservableList<String> observedList = FXCollections.observableArrayList();
|
||||||
|
List<Integer> stackList = ProgramStack.getStack();
|
||||||
|
for (Integer integer : stackList) {
|
||||||
|
observedList.add("0x" + format(Integer.toHexString(integer).toUpperCase()));
|
||||||
|
}
|
||||||
|
stackVisual.setItems(observedList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateWatchdog (){
|
||||||
|
wdtCheck.setText("Watchdog-Timer: " + WatchdogTimer.get() + "µs");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -79,9 +79,9 @@ public class Table {
|
|||||||
Label fsrLabel = new Label("FSR: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase()));
|
Label fsrLabel = new Label("FSR: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase()));
|
||||||
Label pclathLabel = new Label("PCLATH: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase()));
|
Label pclathLabel = new Label("PCLATH: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase()));
|
||||||
Label intconLabel = new Label("INTCON: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase()));
|
Label intconLabel = new Label("INTCON: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase()));
|
||||||
Label wRegisterLabel = new Label("W Register: 0x" + format(Integer.toHexString(Commands.get_wRegister()).toUpperCase()));
|
Label wRegisterLabel = new Label("W-Register: 0x" + format(Integer.toHexString(Commands.get_wRegister()).toUpperCase()));
|
||||||
Label PCLabel = new Label("PC: 0x" + format(Integer.toHexString(DataRegister.getPC()).toUpperCase()));
|
Label PCLabel = new Label("PC: 0x" + format(Integer.toHexString(DataRegister.getPC()).toUpperCase()));
|
||||||
Label Prescaler = new Label("Prescaler: " + format(Integer.toHexString(PreScaler.getScaler())).toUpperCase());
|
Label Prescaler = new Label("Prescaler: 0x" + format(Integer.toHexString(PreScaler.getScaler())).toUpperCase());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@ public class WatchdogTimer {
|
|||||||
private static long watchdogTime;
|
private static long watchdogTime;
|
||||||
private static long lastReset = 0;
|
private static long lastReset = 0;
|
||||||
private static boolean enabled = false;
|
private static boolean enabled = false;
|
||||||
|
private static long rawtimer = 0;
|
||||||
|
private static long realtimer = 0;
|
||||||
|
|
||||||
private static long getTimeFromRegister() {
|
private static long getTimeFromRegister() {
|
||||||
return (PreScaler.isPrescalerOnTimer()) ? 18L : PreScaler.getFactor() * 18L;
|
return (PreScaler.isPrescalerOnTimer()) ? 18L : PreScaler.getFactor() * 18L;
|
||||||
@ -12,16 +14,22 @@ public class WatchdogTimer {
|
|||||||
public static void testAndTrigger() {
|
public static void testAndTrigger() {
|
||||||
watchdogTime = getTimeFromRegister() * 1000;
|
watchdogTime = getTimeFromRegister() * 1000;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (Commands.getTotalExecutionTime() >= (watchdogTime + lastReset - 1)) {
|
if (realtimer >= (watchdogTime + lastReset - 1)) {
|
||||||
DataRegister.clearBit(3, 4);
|
DataRegister.clearBit(3, 4);
|
||||||
lastReset = Commands.getTotalExecutionTime();
|
lastReset = Commands.getTotalExecutionTime();
|
||||||
Controller_Frontend.stopRunFromBackend("Watchdog Timer");
|
Controller_Frontend.stopRunFromBackend("Watchdog Timer");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
rawtimer++;
|
||||||
|
realtimer = (long) (rawtimer * Controller_Frontend.getExecutionTimeMultiplier());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reset (){
|
public static void reset (){
|
||||||
lastReset = Commands.getTotalExecutionTime();
|
lastReset = Commands.getTotalExecutionTime();
|
||||||
|
rawtimer = 0;
|
||||||
|
realtimer = 0;
|
||||||
PreScaler.reset();
|
PreScaler.reset();
|
||||||
DataRegister.setBit(3, 3);
|
DataRegister.setBit(3, 3);
|
||||||
DataRegister.setBit(3, 4);
|
DataRegister.setBit(3, 4);
|
||||||
@ -34,4 +42,8 @@ public class WatchdogTimer {
|
|||||||
public static void disable() {
|
public static void disable() {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long get (){
|
||||||
|
return realtimer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,34 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import com.gluonhq.charm.glisten.control.ToggleButtonGroup?>
|
<?import com.gluonhq.charm.glisten.control.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.collections.*?>
|
||||||
<?import javafx.scene.control.CheckBox?>
|
<?import javafx.geometry.*?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.control.ListView?>
|
<?import javafx.scene.effect.*?>
|
||||||
<?import javafx.scene.control.Menu?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.control.MenuBar?>
|
<?import javafx.scene.paint.*?>
|
||||||
<?import javafx.scene.control.MenuItem?>
|
<?import javafx.scene.shape.*?>
|
||||||
<?import javafx.scene.control.SeparatorMenuItem?>
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.scene.control.ToggleButton?>
|
|
||||||
<?import javafx.scene.effect.Blend?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.paint.Color?>
|
|
||||||
<?import javafx.scene.paint.RadialGradient?>
|
|
||||||
<?import javafx.scene.paint.Stop?>
|
|
||||||
<?import javafx.scene.shape.Circle?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
|
|
||||||
<?import javafx.collections.FXCollections?>
|
<AnchorPane stylesheets="@styles.css" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fabrik.simulator.pic16f84.Controller_Frontend">
|
||||||
<?import javafx.scene.control.ComboBox?>
|
|
||||||
<?import java.lang.String?>
|
|
||||||
<AnchorPane stylesheets="@styles.css" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fabrik.simulator.pic16f84.Controller_Frontend">
|
|
||||||
|
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="lstContentListView" layoutY="31.0" prefHeight="645.0" prefWidth="550.0">
|
<ListView fx:id="lstContentListView" layoutY="31.0" prefHeight="645.0" prefWidth="550.0">
|
||||||
@ -66,7 +49,7 @@
|
|||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<Label fx:id="totalExecutionTimeLabel" text="Total Execution Time: 0µs" />
|
<Label fx:id="totalExecutionTimeLabel" text="Total Execution Time: 0µs" />
|
||||||
<CheckBox fx:id="wdtCheck" mnemonicParsing="false" onAction="#toggleWatchdog" text="Watchdog-Timer">
|
<CheckBox fx:id="wdtCheck" mnemonicParsing="false" onAction="#toggleWatchdog" text="Watchdog-Timer: 0µs">
|
||||||
<Label fx:id="watchdogStatusLabel"/>
|
<Label fx:id="watchdogStatusLabel"/>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets top="10.0" />
|
<Insets top="10.0" />
|
||||||
@ -74,8 +57,13 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
<Text layoutX="659.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="IO-Ports">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="19.0" />
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
|
|
||||||
<HBox layoutX="659.0" layoutY="53.0" prefHeight="293.0" prefWidth="701.0">
|
<HBox layoutX="659.0" layoutY="111.0" prefHeight="293.0" prefWidth="701.0">
|
||||||
<children>
|
<children>
|
||||||
<GridPane alignment="CENTER" gridLinesVisible="true" prefHeight="273.0" prefWidth="687.0">
|
<GridPane alignment="CENTER" gridLinesVisible="true" prefHeight="273.0" prefWidth="687.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@ -751,7 +739,7 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
<VBox alignment="CENTER" layoutX="10.0" layoutY="124.0" GridPane.rowIndex="7">
|
<VBox alignment="CENTER" layoutX="10.0" layoutY="124.0" GridPane.rowIndex="7">
|
||||||
<children>
|
<children>
|
||||||
<CheckBox fx:id="ledCheckB" mnemonicParsing="false" onAction="#toggleLEDs"/>
|
<CheckBox fx:id="ledCheckB" mnemonicParsing="false" onAction="#toggleLEDs" />
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox alignment="CENTER" GridPane.columnIndex="1" GridPane.rowIndex="7">
|
<VBox alignment="CENTER" GridPane.columnIndex="1" GridPane.rowIndex="7">
|
||||||
@ -1022,7 +1010,14 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<MenuBar prefHeight="31.0" prefWidth="1400.0" AnchorPane.bottomAnchor="1400.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<Text layoutX="659.0" layoutY="459.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Stack">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="19.0" />
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
|
<Label fx:id="stackIndex" layoutX="659.0" layoutY="458.0" prefHeight="30.0" prefWidth="111.0" text="Stack-Pointer: 0" />
|
||||||
|
<ListView fx:id="stackVisual" layoutX="659.0" layoutY="489.0" prefHeight="187.0" prefWidth="92.0" />
|
||||||
|
<MenuBar prefHeight="31.0" prefWidth="1400.0" AnchorPane.bottomAnchor="1400.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<menus>
|
<menus>
|
||||||
<Menu mnemonicParsing="false" text="File">
|
<Menu mnemonicParsing="false" text="File">
|
||||||
<items>
|
<items>
|
||||||
|
|||||||
Reference in New Issue
Block a user