java.lang.Object
edsim51sh.TargetBoard
public abstract class TargetBoard
This abstract class contains concrete methods for setting and clearing
port pins and for connecting the target board to the simulator. There
are also two abstract methods for writing to the port pins and for
updating the target board graphics.
| Constructor Summary | |
|---|---|
TargetBoard()
|
|
| Method Summary | |
|---|---|
void |
clearPortPin(int portNumber,
int pinNumber) Clear a port pin (ie: to logic 0), given the port number and the pin number. A call to this method is always successful. |
int |
getBatchElapsedTime()This method returns the length of time (in microseconds) the current batch of 8051 instructions has been executing. |
int |
getInstructionElapsedTime()This method returns the length of time (in microseconds) the most recent 8051 instruction took to execute. |
long |
getProgramElapsedTime()This method returns the length of time (in microseconds) the current 8051 program has been executing. |
void |
init(javax.swing.JPanel gui,
java.lang.String title, java.lang.String version) An instance of TargetBoard should contain a JPanel containing the target board's graphics, its title and its version number. |
boolean |
setPortPin(int portNumber,
int pinNumber) Set a port pin (ie: to logic 1), given the port number and the pin number. Returns true if the port pin was set, false if not. Note: There is no guarantee that calling this method for a given port pin will result in the pin being set. |
void |
setPortPinDescription(int portNumber,
int pinNumber, java.lang.String description) This method takes a port number and a pin number together with a String containing the port pin's description. |
void |
setPortPinDescription(int portNumber,
int pinNumber, java.lang.String description,
java.lang.String toolTip) This method takes a port number and a pin number together with a String containing the port pin's description and another String containing the pin's tooltip. |
abstract
void |
setTargetBoardGraphicsSize(boolean small)
This method is called in response to the zoom button in the simulator's GUI being clicked. With the simulator's default size (ie: small), it may be difficult to see on high resolution monitors. |
abstract
void |
updateTargetBoardGraphics()
This method is called by the simulator after each batch of 8051 instructions has been executed. When the user steps through 8051 code, this method is called after each instruction has been executed. |
abstract
void |
writeToPortPins(PortLatches portLatches)
The programmer must provide an implementation of this abstract method. |
| Constructor Detail |
|---|
public TargetBoard()
| Method Detail |
|---|
public void init(javax.swing.JPanel gui,
java.lang.String title,
java.lang.String version)
title - The title pane at the top of the
simulator's GUI displays EdSim51SH version *.*.*version - The target board's version number is
appended to the title in the simulator's GUI.gui - The target board's graphical user
interface. This GUI will be placed in the simulator's target board
panel.public void setPortPinDescription(int portNumber,
int pinNumber,
java.lang.String description)
portNumber - A number between 0 and 3,
corresponding to P0, P1, P2 and P3 on the 8051. The value in portNumber
is ANDed with 3 (11 in binary) to force it to a value between 0 and 3.pinNumber - A number between 0 and 7,
corresponding to the pin numbers of a given port. The value in
pinNumber is ANDed with 7 (111 in binary) to force it to a value
between 0 and 7.description - A description of the peripheral
this pin is connected to. The first 32 characters in the description
will be displayed in the simulator's top left panel. If the description
is more than 32 characters long it is truncated to 32 characters.public void setPortPinDescription(int portNumber,
int pinNumber,
java.lang.String description,
java.lang.String toolTip)
portNumber - A number between 0 and 3,
corresponding to P0, P1, P2 and P3 on the 8051. The value in portNumber
is ANDed with 3 (11 in binary) to force it to a value between 0 and 3.pinNumber - A number between 0 and 7,
corresponding to the pin numbers of a given port. The value in
pinNumber is ANDed with 7 (111 in binary) to force it to a value
between 0 and 7.description - A description of the peripheral
this pin is connected to.toolTip - A tooltip for the pin can also be set.
The tooltip text will then appear when the user lets the mouse pointer
hover over the pin's description. Setting the tooltip is optional. If
the target board programmer would rather not set the tooltip, the other
version of setPortPinDescription()
should be used (see above).public boolean setPortPin(int portNumber,
int pinNumber)
portNumber - A number between 0 and 3,
corresponding to P0, P1, P2 and P3 on the 8051. The value in portNumber
is ANDed with 3 (11 in binary) to force it to a value between 0 and 3.pinNumber - A number between 0 and 7,
corresponding to the pin numbers of a given port. The value in
pinNumber is ANDed with 7 (111 in binary) to force it to a value
between 0 and 7.public void clearPortPin(int portNumber,
int pinNumber)
portNumber - A number between 0 and 3,
corresponding to P0, P1, P2 and P3 on the 8051. The value in portNumber
is ANDed with 3 (11 in binary) to force it to a value between 0 and 3.pinNumber - A number between 0 and 7,
corresponding to the pin numbers of a given port. The value in
pinNumber is ANDed with 7 (111 in binary) to force it to a value
between 0 and 7.public abstract void writeToPortPins(PortLatches portLatches)
portLatches - A copy of the port latches is
provided to this method for the target board programmer's convenience.
However, it is not necessary for the programmer to examine the latches.
If a pin is to be cleared by the target board, then it will succeed,
regardless of the state of the latch. If a pin is to be set, then the
target board can attempt to set the pin, without checking the latch.
The setPortPin() method
does the checking and fails to set the pin if the latch is 0. Remember,
a pin can never be 1 if its latch is 0.public int getInstructionElapsedTime()This method returns the length of time (in microseconds) the most recent 8051 instruction took to execute, according to the 8051 running with system clock of 12 MHz. For example, a 2-cyle instruction would take 2 microseconds as each cycle is one microsecond.
public int getBatchElapsedTime()This method returns the length of time (in microseconds) the current batch of 8051 instructions has been executing, according to the 8051 running with system
public long getProgramElapsedTime()This method returns the length of time (in microseconds) the current 8051 program has been executing, according to the 8051 running with system clock of 12 MHz.
public abstract void updateTargetBoardGraphics()
public abstract void setTargetBoardGraphicsSize(boolean small)
small - If true: resize the target board GUI to
'small'