picmicrocontroller
Class Register

java.lang.Object
  extended by picmicrocontroller.Register

public class Register
extends java.lang.Object

This class reresents a 8-bit register of a PIC 16F877


Constructor Summary
Register()
          Main constructor of register class.
Register(byte data, byte prevData)
          Constructor which initializes the fields to the given values.
 
Method Summary
 void clear()
          Clears the register.
 void clearBit(int index)
          Clears the bit given the index number 0-7
 int getBit(int index)
          Returns the bit given the index number 0-7
 boolean hasChanged()
          Checks if the content of the register has been changed.
 byte read()
          This method returns the content of a register.
 void setBit(int index)
          Sets the bit given the index number 0-7
 void updateBit(int index, byte bit)
          Updates the bit with a given value and index number 0-7
 void write(byte data)
          This method sets the data of the register.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Register

public Register()
Main constructor of register class. Sets values to 0.


Register

public Register(byte data,
                byte prevData)
Constructor which initializes the fields to the given values.

Parameters:
data -
prevData -
Method Detail

read

public byte read()
This method returns the content of a register.


write

public void write(byte data)
This method sets the data of the register. It also keeps the old value.


getBit

public int getBit(int index)
Returns the bit given the index number 0-7

Parameters:
index -
Returns:

setBit

public void setBit(int index)
Sets the bit given the index number 0-7

Parameters:
index -

clearBit

public void clearBit(int index)
Clears the bit given the index number 0-7

Parameters:
index -

updateBit

public void updateBit(int index,
                      byte bit)
Updates the bit with a given value and index number 0-7

Parameters:
index -
bit -

clear

public void clear()
Clears the register. Keeps the old value.


hasChanged

public boolean hasChanged()
Checks if the content of the register has been changed.