implemented Clrwdt Instruction (#34)
Co-authored-by: Darkress <30271678+DarkressX@users.noreply.github.com> Reviewed-on: darkress/pic16f84-sim#34
This commit was merged in pull request #34.
This commit is contained in:
24
de/darkress/pic16f84sim/commands/Clrwdt.java
Normal file
24
de/darkress/pic16f84sim/commands/Clrwdt.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package de.darkress.pic16f84sim.commands;
|
||||
|
||||
import de.darkress.pic16f84sim.microcontroller.*;
|
||||
|
||||
public class Clrwdt extends LiteralCommandUtils implements Command
|
||||
{
|
||||
|
||||
public Clrwdt()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
ProgramCounter.incPC();
|
||||
Cycles.incCycles();
|
||||
|
||||
Memory.setRegister(0x03, Memory.getRegister(0x03) | 0x18);
|
||||
if(Timer.getPrescalerAssignment()) {
|
||||
Timer.resetTimeToTimerIncrease();
|
||||
Watchdog.resetWatchdogTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class CommandDecoder
|
||||
|
||||
if (input == 0x0064)
|
||||
{
|
||||
//clrwdt();
|
||||
return new Clrwdt();
|
||||
}
|
||||
|
||||
if (input == 0x0009)
|
||||
|
||||
@@ -8,6 +8,10 @@ public class Watchdog
|
||||
return watchdogTimer;
|
||||
}
|
||||
|
||||
public static void resetWatchdogTimer() {
|
||||
watchdogTimer = 18000;
|
||||
}
|
||||
|
||||
public static void decreaseWatchdogTimer()
|
||||
{
|
||||
watchdogTimer--;
|
||||
|
||||
Reference in New Issue
Block a user