jmce.intel.mcs51
Class Port
java.lang.Object
jmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.intel.mcs51.Port
- All Implemented Interfaces:
- MCS51Constants, Hardware, MemoryWriteListener, Peripheral
public class Port
- extends AbstractPeripheral
- implements MCS51Constants, MemoryWriteListener
Standard 8051 I/O port.
Each I/O port in the 8051 have 3 register Px,PxM1 and PxM2. Px is
the data register and PxM1 and PxM1 determine the data direction for
any bit. Some implementation of 8051 can have limitation on some bit
and not all bit can be used in all mode.
Up to 8 port are supported but only P0-3 are configured if one
processor want to use port P4-7 must configure the register with the
static method provided.
I/O Port configuration
Each nit in the data port (Px) have 2 bit to register (PxM1,PxM2) to
define the mode.
PxM1 PxM2
0 0 Quasi bidirectional.
0 1 Push pull.
1 0 Input only.
1 1 Open drain.
- Version:
- 1.00
- Author:
- Mario Viara
Fields inherited from interface jmce.intel.mcs51.MCS51Constants |
ACC, AUXR1, B, DPH, DPL, IE, IE_EA, IE_EC, IE_ES, IE_ET0, IE_ET1, IE_ET2, IE_EX0, IE_EX1, P0, P0M1, P0M2, P1, P1M1, P1M2, P2, P2M1, P2M2, P3, P3M1, P3M2, PSW, PSW_AC, PSW_CY, PSW_F0, PSW_F1, PSW_OV, PSW_P, PSW_RS0, PSW_RS1, SBUF, SCON, SCON_RI, SCON_TI, SP, TCON, TCON_TF0, TCON_TF1, TCON_TR0, TCON_TR1, TH0, TH1, TL0, TL1, TMOD, TMOD_C_T0, TMOD_C_T1, TMOD_GATE0, TMOD_GATE1, TMOD_T0_M0, TMOD_T0_M1, TMOD_T1_M0, TMOD_T1_M1 |
Constructor Summary |
Port()
Default constructor |
Port(int port)
|
Methods inherited from class jmce.sim.AbstractHardware |
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jmce.sim.Hardware |
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
sfrPorts
public static int[] sfrPorts
sfrM1s
public static int[] sfrM1s
sfrM2s
public static int[] sfrM2s
Port
public Port()
- Default constructor
Port
public Port(int port)
registerCPU
public void registerCPU(CPU cpu)
throws SIMException
- Description copied from interface:
Peripheral
- Register a parent CPU for future reference.
- Specified by:
registerCPU
in interface Peripheral
- Overrides:
registerCPU
in class AbstractPeripheral
- Throws:
SIMException
setPortNum
public void setPortNum(int n)
getPortNum
public int getPortNum()
setDisableMask
public void setDisableMask(int mask)
getDisableMask
public int getDisableMask()
setPort
protected void setPort(int value)
setM1
protected void setM1(int value)
setM2
protected void setM2(int value)
getPort
protected int getPort()
getM1
protected int getM1()
getM2
protected int getM2()
writeMemory
public void writeMemory(Memory m,
int sfr,
int value,
int oldValue)
throws SIMException
- Description copied from interface:
MemoryWriteListener
- Called when a memory write event occours.
This method is called when a memory write operation occours
in the specified memory.
- Specified by:
writeMemory
in interface MemoryWriteListener
- Parameters:
m
- - Memory involved in the write operation.sfr
- - Address written.value
- - Value written.oldValue
- - Old value of this memory location.
- Throws:
SIMException
readMemory
public int readMemory(Memory m,
int sfr,
int v)
throws SIMException
- Throws:
SIMException