Files
pic16f84-sim/de/darkress/pic16f84sim/microcontroller/Timer.java
2023-06-15 20:53:19 +02:00

20 lines
501 B
Java

package de.darkress.pic16f84sim.microcontroller;
public class Timer
{
private boolean getPrescalerAsssignment() {
return (Memory.getOption() & 0x08) == 0x08;
}
private int getPrescalerFactor() {
final int MULTIPLIER = 2;
int prescalerPower = Memory.getOption() & 0x07;
int prescaler = (int)Math.pow(2, prescalerPower);
if(!getPrescalerAsssignment())
{
return prescaler * MULTIPLIER;
}
return prescaler;
}
}