diff --git a/bin/Control/MyControlModel.class b/bin/Control/MyControlModel.class index c540a8a..644cc85 100644 Binary files a/bin/Control/MyControlModel.class and b/bin/Control/MyControlModel.class differ diff --git a/bin/Control/MyControlView.class b/bin/Control/MyControlView.class index a2178ab..ca9be9c 100644 Binary files a/bin/Control/MyControlView.class and b/bin/Control/MyControlView.class differ diff --git a/bin/Model/Microcontroller/PIC.class b/bin/Model/Microcontroller/PIC.class index eaf5508..71b082c 100644 Binary files a/bin/Model/Microcontroller/PIC.class and b/bin/Model/Microcontroller/PIC.class differ diff --git a/bin/Model/Microcontroller/RUNTIMER.class b/bin/Model/Microcontroller/RUNTIMER.class index 5b2748a..e66e5f3 100644 Binary files a/bin/Model/Microcontroller/RUNTIMER.class and b/bin/Model/Microcontroller/RUNTIMER.class differ diff --git a/bin/Model/Microcontroller/WATCHDOG.class b/bin/Model/Microcontroller/WATCHDOG.class deleted file mode 100644 index ec31c61..0000000 Binary files a/bin/Model/Microcontroller/WATCHDOG.class and /dev/null differ diff --git a/bin/Model/MyModel.class b/bin/Model/MyModel.class index eb89de8..b0c22cc 100644 Binary files a/bin/Model/MyModel.class and b/bin/Model/MyModel.class differ diff --git a/bin/Runtime/Main.class b/bin/Runtime/Main.class index 1715eef..062d5f7 100644 Binary files a/bin/Runtime/Main.class and b/bin/Runtime/Main.class differ diff --git a/bin/View/GUIAbout.class b/bin/View/GUIAbout.class new file mode 100644 index 0000000..66cc5d9 Binary files /dev/null and b/bin/View/GUIAbout.class differ diff --git a/bin/View/GUIHelp.class b/bin/View/GUIHelp.class new file mode 100644 index 0000000..fbdad1d Binary files /dev/null and b/bin/View/GUIHelp.class differ diff --git a/bin/View/GUITime.class b/bin/View/GUITime.class index 046f622..94c61f3 100644 Binary files a/bin/View/GUITime.class and b/bin/View/GUITime.class differ diff --git a/documentation/WORD/.~lock.Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx# b/documentation/WORD/.~lock.Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx# deleted file mode 100644 index e846f15..0000000 --- a/documentation/WORD/.~lock.Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx# +++ /dev/null @@ -1 +0,0 @@ -,aaron_moser,aaron-moser-ThinkPad-T430,08.04.2022 11:11,file:///home/aaron_moser/.config/libreoffice/4; \ No newline at end of file diff --git a/documentation/WORD/Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx b/documentation/WORD/Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx index 0d109f0..ce3edd1 100755 Binary files a/documentation/WORD/Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx and b/documentation/WORD/Rechnerarchitektur Selbststudium Skript Verbesserungsvorschläge.docx differ diff --git a/src/Control/MyControlModel.java b/src/Control/MyControlModel.java index 534e4c0..53bd77f 100644 --- a/src/Control/MyControlModel.java +++ b/src/Control/MyControlModel.java @@ -3,6 +3,8 @@ package Control; import Model.MyModelData; import Model.EepromLoader.ReadEepromFile; import Model.Microcontroller.PIC; +import View.GUIAbout; +import View.GUIHelp; import View.MyView; import java.awt.event.ActionEvent; @@ -259,9 +261,11 @@ public class MyControlModel implements ActionListener { oMyView.setLanguage(1); }break; case 15: { + new GUIHelp(); //Show manual }break; case 16: { + new GUIAbout(); //Show about }break; } @@ -292,5 +296,6 @@ public class MyControlModel implements ActionListener { oMenuItem.addActionListener(this); } } + } } \ No newline at end of file diff --git a/src/Control/MyControlView.java b/src/Control/MyControlView.java index 475f962..e8371af 100644 --- a/src/Control/MyControlView.java +++ b/src/Control/MyControlView.java @@ -27,6 +27,7 @@ public class MyControlView { setRegistersDetailed(); setStack(); setTestFileTable(); + setMCMenu(); } /** @@ -149,6 +150,10 @@ public class MyControlView { oMyView.getGUIPorts().enableCheckboxesB(abEnabled); } + public void setMCMenu() { + oMyView.getGUITime().setRuntime(oPIC.getRuntimer().getRuntime()); + } + public void setRamView() { int[] aiData; int[] aiBank0 = oPIC.getRam().get_Bank0(); diff --git a/src/Model/Microcontroller/PIC.java b/src/Model/Microcontroller/PIC.java index c24b57a..4bdfc7e 100755 --- a/src/Model/Microcontroller/PIC.java +++ b/src/Model/Microcontroller/PIC.java @@ -17,18 +17,21 @@ public class PIC { private RAM Ram; private STACK Stack; private int WRegister; + private RUNTIMER Runtimer; public PIC() { //Initialising objects of PIC. Eeprom = new EEPROM(); Ram = new RAM(); Stack = new STACK(); + Runtimer = new RUNTIMER(Ram); WRegister = 0; } public synchronized void resetPIC() { Ram = new RAM(); Stack = new STACK(); + Runtimer = new RUNTIMER(Ram); WRegister = 0; } @@ -78,6 +81,10 @@ public class PIC { return Stack; } + public synchronized RUNTIMER getRuntimer() { + return Runtimer; + } + /** * Datasheet Page 57 * @@ -137,6 +144,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PCL and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -173,6 +182,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -258,6 +269,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -309,6 +322,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -337,6 +352,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -378,6 +395,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -404,6 +423,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -441,6 +462,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -469,9 +492,10 @@ public class PIC { if (Ram.get_T0CS() == false) Ram.increment_TMR0(); - //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -492,6 +516,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -512,6 +538,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -537,6 +565,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -583,6 +613,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -632,6 +664,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -679,6 +713,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -701,6 +737,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -749,6 +787,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -805,6 +845,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -838,6 +880,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -879,6 +923,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -899,6 +945,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -937,6 +985,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -955,6 +1005,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -970,6 +1022,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -997,6 +1051,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /**OPTION @@ -1012,6 +1068,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } @@ -1039,6 +1097,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1061,6 +1121,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1117,6 +1179,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1172,6 +1236,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1195,6 +1261,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1251,6 +1319,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1326,6 +1396,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1363,6 +1435,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1388,6 +1462,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1419,6 +1495,8 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } /** @@ -1462,5 +1540,7 @@ public class PIC { //Each Instruction has to split Programmcounter to PC and PCLATH because Ram can't see RAM. Ram.set_PCL(Ram.get_Programcounter() & 0b0000011111111); + + Runtimer.incrementRuntime(); } } \ No newline at end of file diff --git a/src/Model/Microcontroller/RUNTIMER.java b/src/Model/Microcontroller/RUNTIMER.java index f6d149f..cca638c 100644 --- a/src/Model/Microcontroller/RUNTIMER.java +++ b/src/Model/Microcontroller/RUNTIMER.java @@ -1,5 +1,100 @@ package Model.Microcontroller; public class RUNTIMER { - -} + private double dRuntime; + private double dMaxWatchdog; + private double dRTIncrVal; + + private boolean WDTE = false; + + private RAM oRam; + + public RUNTIMER(RAM oRam) { + this.oRam = oRam; + } + + public void setMaxWatchdog(double dMaxVal) { + dMaxWatchdog = dMaxVal; + } + + private void checkWatchdog() { + if (WDTE) { + if (oRam.get_PSA()) { + setMaxWatchdog(18000 * oRam.get_WDT_PrescalerRate()); + } else { + setMaxWatchdog(18000);//18 ms + } + if ((dMaxWatchdog - dRuntime) <= 0) { + System.out.println("WDT Interrupt"); + } + } + } + + public double getRuntime() { + return dRuntime; + } + + public void setRuntime(double liVal) { + dRuntime = liVal; + } + + public void incrementRuntime() { + dRuntime += dRTIncrVal; + checkWatchdog(); + } + + public void setQuarzSpeed(int iInterval) { + switch (iInterval) { + //10 {"32 kHz", "100 kHz", "500 kHz", "1 MHz", "2 MHz", "4 MHz", "8 MHz", "12 MHz", "16 MHz", "20 MHz"} + case 0: { + //32 kHz => 125 mikrosekunden = 0.125ms + dRTIncrVal = 0.001 * (4 / 0.032); + }break; + + case 1: { + //100kHz => 40 mikrosekunden = 0.040 ms + dRTIncrVal = 0.001 * (4 / 0.1); + }break; + + case 2: { + //500kHz => 8 mikrosekunden = 0.008 ms + dRTIncrVal = 0.001 * (4 / 0.5); + }break; + + case 3: { + //1MHz => 4 mikrosekunden = 0.004 ms + dRTIncrVal = 0.001 * (4 / 1); + }break; + + case 4: { + //2MHz => 2 mikrosekunden = 0.002 ms + dRTIncrVal = 0.001 * (4 / 2); + }break; + + case 5: { + //4MHz => 1 mikrosekunde = 0.001 ms + dRTIncrVal = 0.001 * (4 / 4); + }break; + + case 6: { + //8MHz => 0.5 mikrosekunden = 0.0005 ms + dRTIncrVal = 0.001 * (4 / 8); + }break; + + case 7: { + //12MHz => 0.33 mikrosekunden = 0.0003 ms + dRTIncrVal = 0.001 * (4 / 12); + }break; + + case 8: { + //16MHz => 0.25 mikrosekunden = 0.00025 ms + dRTIncrVal = 0.001 * (4 / 16); + }break; + + case 9: { + //20MHz => 0.20 mikrosekunden = 0.00020 ms + dRTIncrVal = 0.001 * (4 / 20); + }break; + } + } +} \ No newline at end of file diff --git a/src/Model/Microcontroller/WATCHDOG.java b/src/Model/Microcontroller/WATCHDOG.java deleted file mode 100755 index 965a484..0000000 --- a/src/Model/Microcontroller/WATCHDOG.java +++ /dev/null @@ -1,105 +0,0 @@ -package Model.Microcontroller; - -/** - * @author Aaron Moser - * @date 23.06.2021 - * @lastchange 23.06.2021 - */ - -//Doesn't work correctly, status is changed too fast. -public class WATCHDOG extends Thread -{ - private long time; - private int watchdogStatus; - private long timeStart; - private long timeEnd; - - /** - * Constructor of watchdog. - */ - public WATCHDOG() - { - time = 0; - watchdogStatus = 0; - timeStart = 0; - timeEnd = 0; - } - - /** - * @return time in microseconds of watchdog. - */ - public synchronized long getTime() - { - return this.time / 100; - } - - /** - * Sets time of watchdog. - * @param value of new time. - */ - public synchronized void setTime(long value) - { - this.time = value; - } - - /** - * @return Status of watchdog. - * 0: Waiting for start - * 1: Start Watchdog - * 2: GetTime Watchdog - * 3: End Watchdog - * 4: Stop Watchdog - */ - public synchronized int getWatchdogStatus() - { - return this.watchdogStatus; - } - - /** - * 0: Waiting for start - * 1: Start Watchdog - * 2: GetTime Watchdog - * 3: End Watchdog - * 4: Stop Watchdog - * @param value - */ - public synchronized void setWatchdogStatus(int value) - { - this.watchdogStatus = value; - } - - /** - * Makes it possible to create a thread of watchdog. - */ - @Override - public void run() - { - //If status is changed to 3, watchdog is stopped. - while (this.watchdogStatus != 3) - { - if (watchdogStatus != 4) - { - //If status changes to 1, starts to count time and sets status to 4. - if (this.watchdogStatus == 1) - { - this.timeStart = System.nanoTime(); - if (this.getWatchdogStatus() != 2) - { - this.setWatchdogStatus(4); - } - } - - //If status changes to 2, stops count time and sets time to new value, then sets status to 4. - if (this.watchdogStatus == 2) - { - this.timeEnd = System.nanoTime(); - if (this.getWatchdogStatus() != 1) - { - this.setWatchdogStatus(4); - } - this.setTime(this.timeEnd - this.timeStart); - } - } - } - } -} \ No newline at end of file diff --git a/src/Model/MyModel.java b/src/Model/MyModel.java index 0897af2..0ca3b1d 100644 --- a/src/Model/MyModel.java +++ b/src/Model/MyModel.java @@ -113,66 +113,13 @@ public class MyModel extends Thread { } } - private void setQuarzSpeed(int iInterval) { //TODO Quartz - switch (iInterval) { - //10 {"32 kHz", "100 kHz", "500 kHz", "1 MHz", "2 MHz", "4 MHz", "8 MHz", "12 MHz", "16 MHz", "20 MHz"} - case 0: { - //32 kHz => - dRTIncrVal = (4 / 0.032); - }break; - - case 1: { - //100kHz => 0.000010s - dRTIncrVal = (4 / 0.1); - }break; - - case 2: { - //500kHz => 0.0000020s - dRTIncrVal = (4 / 0.5); - }break; - - case 3: { - //1MHz => 0.0000010s - dRTIncrVal = (4 / 1); - }break; - - case 4: { - //2MHz => 0.0000005s - dRTIncrVal = (4 / 2); - }break; - - case 5: { - //4MHz => 0.00000025s 1 mükrosekunde - dRTIncrVal = (4 / 4); - }break; - - case 6: { - //8MHz => 0.000000125s - dRTIncrVal = (4 / 8); - }break; - - case 7: { - //12MHz => 0.00000008333333 - dRTIncrVal = (4 / 12); - }break; - - case 8: { - //16MHz => 0.0000000625 - dRTIncrVal = (4 / 16); - }break; - - case 9: { - //20MHz => 0.00000005 - dRTIncrVal = (4 / 20); - }break; - } - } + private void setModel(MyModelData data) { oMyModelData = data; oPIC = oMyModelData.getPIC(); abBreakpoints = oMyModelData.getBreakpoints(); - setQuarzSpeed(oMyModelData.getQuartzInterval()); + oPIC.getRuntimer().setQuarzSpeed(oMyModelData.getQuartzInterval()); iVisualInterval = oMyModelData.getVisualInterval(); } } diff --git a/src/Runtime/Main.java b/src/Runtime/Main.java index 11f8077..0c55d3f 100755 --- a/src/Runtime/Main.java +++ b/src/Runtime/Main.java @@ -24,11 +24,11 @@ public class Main { MyView oView = new MyView(); MyControlView oControlView = new MyControlView(oPIC, oView); - + new MyControlModel(oView, qCommandsToModel, qDataToModel); //Check if model sent a new pic-element through queue and update view. - while (qCommandsToModel.peek() > 0) { + while (true) { while (!qDataToView.isEmpty()) { PIC pic = qDataToView.poll(); oControlView.setPIC(pic); diff --git a/src/View/GUIAbout.java b/src/View/GUIAbout.java new file mode 100644 index 0000000..90af5c0 --- /dev/null +++ b/src/View/GUIAbout.java @@ -0,0 +1,53 @@ +package View; + +import java.awt.Dimension; + +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; + +public class GUIAbout extends JFrame { + public GUIAbout() { + // sets title of frame + this.setTitle("PIC-Simulator GUI - About"); + + //prevent frame from beeing resized + this.setResizable(false); + + //sets x and y dimension of frame + this.setSize(650, 420); + + //Set Icon + ImageIcon guiLogo = new ImageIcon("./pictures/gui_logo.png"); // create an ImageIcon + this.setIconImage(guiLogo.getImage()); // change icon of frame + + this.setVisible(true); + + JScrollPane oJScrollPane = new JScrollPane(); + + JPanel oAboutPanel = new JPanel(); + + JTextArea oAboutText = new JTextArea(); + oAboutText.setLineWrap(true); + oAboutText.setPreferredSize(new Dimension(600, 400)); + oAboutText.setEditable(false); + + oAboutPanel.add(oAboutText); + + oAboutText.setText( "Hochschule Offenburg SS2022\n" + + "Projekt Rechnerarchitektur - Simulator Mikroprozessor 16F84\n" + + "Entwickler: Aaron Moser\n" + + "Programmiersprache: Java\n" + + "Entwicklungsumgebung: Visual Studio Code\n"); + + oJScrollPane.setViewportView(oAboutPanel); + oJScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + oJScrollPane.setWheelScrollingEnabled(true); + oJScrollPane.getVerticalScrollBar().setUnitIncrement(16); + + this.add(oJScrollPane); + } +} diff --git a/src/View/GUIHelp.java b/src/View/GUIHelp.java new file mode 100644 index 0000000..cf2972b --- /dev/null +++ b/src/View/GUIHelp.java @@ -0,0 +1,54 @@ +package View; + +import java.awt.Dimension; + +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; + +public class GUIHelp extends JFrame { + public GUIHelp() { + // sets title of frame + this.setTitle("PIC-Simulator GUI - Help"); + + //prevent frame from beeing resized + this.setResizable(false); + + //sets x and y dimension of frame + this.setSize(650, 420); + + //Set Icon + ImageIcon guiLogo = new ImageIcon("./pictures/gui_logo.png"); // create an ImageIcon + this.setIconImage(guiLogo.getImage()); // change icon of frame + + this.setVisible(true); + + + JScrollPane oJScrollPane = new JScrollPane(); + + JPanel oHelpPanel = new JPanel(); + + JTextArea oHelpText = new JTextArea(); + oHelpText.setLineWrap(true); + oHelpText.setPreferredSize(new Dimension(600, 400)); + oHelpText.setEditable(false); + + oHelpPanel.add(oHelpText); + + oHelpText.setText( "\n" + + "\n" + + "\n" + + "\n" + + "\n"); + + oJScrollPane.setViewportView(oHelpPanel); + oJScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + oJScrollPane.setWheelScrollingEnabled(true); + oJScrollPane.getVerticalScrollBar().setUnitIncrement(16); + + this.add(oJScrollPane); + } +} diff --git a/src/View/GUITime.java b/src/View/GUITime.java index 50e2269..630237d 100644 --- a/src/View/GUITime.java +++ b/src/View/GUITime.java @@ -1,6 +1,7 @@ package View; import java.awt.Color; +import java.awt.Dimension; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.GridBagConstraints; @@ -33,16 +34,19 @@ public class GUITime extends JPanel { JLabel oLabelWDT = new JLabel("Watchdog Timer"); JCheckBox oEnableWDT = new JCheckBox("WDT"); - int iRuntime = 0; - JLabel oLabelRuntime = new JLabel("Runtime: " + iRuntime); + double dRuntime = 0; + JLabel oLabelRuntime = new JLabel("Runtime: " + dRuntime); JLabel oLabelQuarz = new JLabel("Quarzfrequency"); String[] asIntervals = {"32 kHz", "100 kHz", "500 kHz", "1 MHz", "2 MHz", "4 MHz", "8 MHz", "12 MHz", "16 MHz", "20 MHz"}; JComboBox oIntervals = new JComboBox<>(asIntervals); + int iLanguage; + public GUITime() { buildGUITime(); setLanguage(0); + oLabelRuntime.setPreferredSize(new Dimension(150, 20)); } private void buildGUITime() { @@ -70,13 +74,14 @@ public class GUITime extends JPanel { } public void setLanguage(int iLangNr) { + iLanguage = iLangNr; switch (iLangNr) { case 0: { - oLabelRuntime.setText("Laufzeit: " + iRuntime); + oLabelRuntime.setText("Laufzeit: " + dRuntime); oLabelQuarz.setText("Quarzfrequenz"); }break; case 1: { - oLabelRuntime.setText("Runtime: " + iRuntime); + oLabelRuntime.setText("Runtime: " + dRuntime); oLabelQuarz.setText("Quarzfrequency"); }break; } @@ -90,12 +95,18 @@ public class GUITime extends JPanel { return oEnableWDT; } - public void setRuntime(int iRuntime) { - this.iRuntime = iRuntime; + public void setRuntime(double dRuntime) { + this.dRuntime = dRuntime; + if (iLanguage == 0) { + oLabelRuntime.setText("Laufzeit: " + dRuntime); + } else { + oLabelRuntime.setText("Runtime: " + dRuntime); + } + } - public int getRuntime() { - return iRuntime; + public double getRuntime() { + return dRuntime; } public void setTheme(int iThemeNr) {