picmicrocontroller
Class PIC

java.lang.Object
  extended by picmicrocontroller.PIC

public class PIC
extends java.lang.Object

This class represents a PIC 16F877.


Field Summary
static int _PORTA
           
static int _PORTB
           
static int _PORTC
           
static int _PORTD
           
static int _PORTE
           
static int _TRISA
           
static int _TRISB
           
static int _TRISC
           
static int _TRISD
           
static int _TRISE
           
static int _W
           
static int ADCON0
           
static int ADCON1
           
protected  ADConverter adConverter
           
static int ADRESH
           
static int ADRESL
           
 double[] analog
          analog data analog[0-3] PORTA.0-3 analog[4] PORTA.5 analog [5-7] PORTE.0-2
static int BANK0
           
static int BANK1
           
static int BANK2
           
static int BANK3
           
protected  DataMemory dataMemory
           
 java.lang.String fileName
           
 FlashProgramMemory flashProgramMemory
           
static int FSR
           
static int INDIRECT
           
static int INTCON
           
static int OPTION_REG
           
static int PCL
           
static int PCLATH
           
static int PR2
           
protected  ProgramCounter programCounter
           
protected  java.util.Stack ProgramCounterStack
           
 SimulatorFrame simulatorFrame
           
static int STATUS
           
 SimThread task1
           
 java.util.concurrent.ExecutorService threadExecutor
           
 boolean threadFromPause
           
 boolean threadPaused
           
static int TMR0
           
static int TXSTA
           
protected  Register WDT
           
protected  Register wreg
           
 
Constructor Summary
PIC(SimulatorFrame frame, java.lang.String name)
          Main constructor of the PIC class.
 
Method Summary
 Instruction decodeInstr(int iCode)
          This method decodes an instruction code and returns an Instruction object which may be used for simulation.
 void finishSimulation()
          This method closes the simulator thread.
 ADConverter getADConverter()
           
 DataMemory getDataMemory()
           
 FlashProgramMemory getFlashProgramMemory()
           
 ProgramCounter getProgramCounter()
           
 SimulatorFrame getSimulatorFrame()
           
static void main(java.lang.String[] args)
          Main procedure for testing.
 void readHEX(java.lang.String inFileName)
          This method gets a HEX file and uploads it to the flash program memory
 void setDataMemory(DataMemory dataMemory)
           
 void setFlashProgramMemory(FlashProgramMemory flashProgramMemory)
           
 void setProgramCounter(ProgramCounter programCounter)
           
 void simulatePIC()
          This method loads the hex file specified by the filename and creates a thread to simulate PIC cycles.
 void sleep()
          This method is used to pause the simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BANK0

public static int BANK0

BANK1

public static int BANK1

BANK2

public static int BANK2

BANK3

public static int BANK3

_W

public static int _W

INDIRECT

public static final int INDIRECT
See Also:
Constant Field Values

TMR0

public static final int TMR0
See Also:
Constant Field Values

PCL

public static final int PCL
See Also:
Constant Field Values

STATUS

public static final int STATUS
See Also:
Constant Field Values

FSR

public static final int FSR
See Also:
Constant Field Values

PCLATH

public static final int PCLATH
See Also:
Constant Field Values

INTCON

public static final int INTCON
See Also:
Constant Field Values

ADRESH

public static final int ADRESH
See Also:
Constant Field Values

ADRESL

public static final int ADRESL
See Also:
Constant Field Values

ADCON0

public static final int ADCON0
See Also:
Constant Field Values

ADCON1

public static final int ADCON1
See Also:
Constant Field Values

OPTION_REG

public static final int OPTION_REG
See Also:
Constant Field Values

PR2

public static final int PR2
See Also:
Constant Field Values

TXSTA

public static final int TXSTA
See Also:
Constant Field Values

_PORTA

public static int _PORTA

_PORTB

public static int _PORTB

_PORTC

public static int _PORTC

_PORTD

public static int _PORTD

_PORTE

public static int _PORTE

_TRISA

public static int _TRISA

_TRISB

public static int _TRISB

_TRISC

public static int _TRISC

_TRISD

public static int _TRISD

_TRISE

public static int _TRISE

dataMemory

protected DataMemory dataMemory

flashProgramMemory

public FlashProgramMemory flashProgramMemory

wreg

protected Register wreg

programCounter

protected ProgramCounter programCounter

ProgramCounterStack

protected java.util.Stack ProgramCounterStack

WDT

protected Register WDT

adConverter

protected ADConverter adConverter

analog

public double[] analog
analog data analog[0-3] PORTA.0-3 analog[4] PORTA.5 analog [5-7] PORTE.0-2


simulatorFrame

public SimulatorFrame simulatorFrame

threadExecutor

public java.util.concurrent.ExecutorService threadExecutor

task1

public SimThread task1

threadPaused

public boolean threadPaused

threadFromPause

public boolean threadFromPause

fileName

public java.lang.String fileName
Constructor Detail

PIC

public PIC(SimulatorFrame frame,
           java.lang.String name)
Main constructor of the PIC class. Initializes memories and modules of PIC 16F877

Method Detail

readHEX

public void readHEX(java.lang.String inFileName)
             throws java.io.IOException
This method gets a HEX file and uploads it to the flash program memory

Parameters:
inFileName -
Throws:
java.io.IOException

decodeInstr

public Instruction decodeInstr(int iCode)
This method decodes an instruction code and returns an Instruction object which may be used for simulation.

Parameters:
iCode - instruction code
Returns:
instruction object

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Main procedure for testing. Creates a stand alone simulator.

Parameters:
args -
Throws:
java.io.IOException

simulatePIC

public void simulatePIC()
                 throws java.io.IOException
This method loads the hex file specified by the filename and creates a thread to simulate PIC cycles.

Throws:
java.io.IOException

finishSimulation

public void finishSimulation()
This method closes the simulator thread.


getDataMemory

public DataMemory getDataMemory()
Returns:
the dataMemory

setDataMemory

public void setDataMemory(DataMemory dataMemory)
Parameters:
dataMemory - the dataMemory to set

getFlashProgramMemory

public FlashProgramMemory getFlashProgramMemory()
Returns:
the flashProgramMemory

setFlashProgramMemory

public void setFlashProgramMemory(FlashProgramMemory flashProgramMemory)
Parameters:
flashProgramMemory - the flashProgramMemory to set

getSimulatorFrame

public SimulatorFrame getSimulatorFrame()

getProgramCounter

public ProgramCounter getProgramCounter()
Returns:
the programCounter

setProgramCounter

public void setProgramCounter(ProgramCounter programCounter)
Parameters:
programCounter - the programCounter to set

getADConverter

public ADConverter getADConverter()
Returns:
the adConverter

sleep

public void sleep()
This method is used to pause the simulation.