20 lines
501 B
Java
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;
|
|
}
|
|
}
|