EEPROM-time
This commit is contained in:
@ -258,14 +258,13 @@ public class Commands {
|
|||||||
public static void addExecutionTime(int i) {
|
public static void addExecutionTime(int i) {
|
||||||
totalExecutionTime += i;
|
totalExecutionTime += i;
|
||||||
Timer.cycles(i);
|
Timer.cycles(i);
|
||||||
|
EEPROM.registerTime(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getTotalExecutionTime() {
|
public static long getTotalExecutionTime() {
|
||||||
return totalExecutionTime;
|
return totalExecutionTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void MOVWF(int file) {
|
public static void MOVWF(int file) {
|
||||||
DataRegister.setRegister(file, wRegister);
|
DataRegister.setRegister(file, wRegister);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,7 +135,7 @@ public class Controller_Frontend {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Thread.sleep(50); //Verzögerungszeit in Millisekunden
|
Thread.sleep(80); //Verzögerungszeit in Millisekunden
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import static fabrik.simulator.pic16f84.Commands.getTotalExecutionTime;
|
||||||
|
|
||||||
public class EEPROM {
|
public class EEPROM {
|
||||||
private static final int EEDATA = 0x08;
|
private static final int EEDATA = 0x08;
|
||||||
private static final int EEADR = 0x09;
|
private static final int EEADR = 0x09;
|
||||||
@ -26,6 +28,8 @@ public class EEPROM {
|
|||||||
private static boolean writeControl = false;
|
private static boolean writeControl = false;
|
||||||
private static boolean [] eecon2stages = {false, false};
|
private static boolean [] eecon2stages = {false, false};
|
||||||
|
|
||||||
|
private static long startTime;
|
||||||
|
|
||||||
public static long read (int address) {
|
public static long read (int address) {
|
||||||
FileReader reader;
|
FileReader reader;
|
||||||
try {
|
try {
|
||||||
@ -73,10 +77,19 @@ public class EEPROM {
|
|||||||
DataRegister.setDirectBit(EECON1, WRERR, 1);
|
DataRegister.setDirectBit(EECON1, WRERR, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
eecon2stages = new boolean[]{false, false};
|
registerTime(true);
|
||||||
DataRegister.setDirectBit(EECON1, EEIF, 1);
|
}
|
||||||
DataRegister.setDirectBit(EECON1, WR, 0);
|
|
||||||
writeControl = false;
|
public static void registerTime(boolean reset) {
|
||||||
|
if (reset)
|
||||||
|
startTime = getTotalExecutionTime();
|
||||||
|
else if ((getTotalExecutionTime() >= (startTime + 1000)) && writeControl) {
|
||||||
|
eecon2stages = new boolean[]{false, false};
|
||||||
|
DataRegister.setDirectBit(EECON1, EEIF, 1);
|
||||||
|
DataRegister.setDirectBit(EECON1, WR, 0);
|
||||||
|
writeControl = false;
|
||||||
|
startTime = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void parse(int address, int content, int opcode) {
|
public static void parse(int address, int content, int opcode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user