timer0 Interrupt fully working
This commit is contained in:
@@ -26,6 +26,8 @@ public class Cli
|
||||
System.out.printf("%s:\t\t%s\t", "PortA", Integer.toBinaryString(Memory.getPortA()));
|
||||
System.out.printf("%s:\t\t%s\t", "PortB", Integer.toBinaryString(Memory.getPortB()));
|
||||
System.out.printf("%n");
|
||||
printf(Memory.getRegister(0x0B), "IntCon", true);
|
||||
System.out.printf("%n");
|
||||
}
|
||||
|
||||
private static void printf(int value, String description, boolean hex) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package de.darkress.pic16f84sim.microcontroller;
|
||||
public class Interrupt
|
||||
{
|
||||
private static boolean globalInterruptEnabled() {
|
||||
return (Memory.getRegister(0x0B) & 0x80) == 0x80;
|
||||
return (Memory.getRegister(0x0B) & 0x80) == 0x80; // Check GIE
|
||||
|
||||
}
|
||||
public static boolean checkTimerInterruptConditions() {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Timer
|
||||
{
|
||||
int timerRegister = Memory.getRegister(0x01);
|
||||
timerRegister = (timerRegister + 1) % 256;
|
||||
if(timerRegister == 0 && !((Memory.getRegister(0x0B) & 0x04) == 0x04)) //check for timer Overflow --> interrupt
|
||||
if(timerRegister == 0)// && !((Memory.getRegister(0x0B) & 0x04) == 0x04)) //check for timer Overflow --> interrupt
|
||||
{
|
||||
System.out.println("Timer Overflow");
|
||||
Memory.setRegister(0x0B, Memory.getRegister(0x0B) | 0x04); //set T0IF
|
||||
|
||||
Reference in New Issue
Block a user