hades.models.special
Class GraphicsLCD

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.special.GraphicsLCD
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable, Wakeable

public class GraphicsLCD
extends SimObject
implements Simulatable, Wakeable

GraphicsLCD: display with dual Samsung KS0108 LCD controller.

This class models the logical function of a 128x64 pixel graphical liquid crystal display controlled by a dual KS0108 controller chip.

See Also:
Serialized Form

Nested Class Summary
(package private)  class GraphicsLCD.KS0108
          An inner class that models the Samsung KS0108 LCD controller for a 64x64 dot matrix display.
 
Field Summary
protected static int BIT_D0
           
protected static int BIT_D1
           
protected static int BIT_D2
           
protected static int BIT_D3
           
protected static int BIT_D4
           
protected static int BIT_D5
           
protected static int BIT_D6
           
protected static int BIT_D7
           
protected static int BIT_E
           
protected static int BIT_nCS1
           
protected static int BIT_nCS2
           
protected static int BIT_nR
           
protected static int BIT_RS
           
protected static int BIT_RW
           
protected  boolean busy
           
protected  int command_word
           
(package private)  boolean debug
           
(package private)  GraphicsLCD.KS0108 driver1
           
(package private)  GraphicsLCD.KS0108 driver2
           
(package private)  GraphicsLCDCanvas lcdCanvas
           
protected static int NO_CS_BITS
           
protected  PortStdLogic1164 port_D0
           
protected  PortStdLogic1164 port_D1
           
protected  PortStdLogic1164 port_D2
           
protected  PortStdLogic1164 port_D3
           
protected  PortStdLogic1164 port_D4
           
protected  PortStdLogic1164 port_D5
           
protected  PortStdLogic1164 port_D6
           
protected  PortStdLogic1164 port_D7
           
protected  PortStdLogic1164 port_E
           
protected  PortStdLogic1164 port_nCS1
           
protected  PortStdLogic1164 port_nCS2
           
protected  PortStdLogic1164 port_nR
           
protected  PortStdLogic1164 port_RS
           
protected  PortStdLogic1164 port_RW
           
protected  PortStdLogic1164 port_VO
           
protected  Label symbolTypeLabel
           
 int t_awt_repaint_millis
           
(package private)  java.awt.Image theIcon
           
(package private)  javax.swing.JFrame topFrame
           
protected  StdLogic1164 value_0
           
protected  StdLogic1164 value_1
           
protected  StdLogic1164 value_H
           
protected  StdLogic1164 value_X
           
 
Fields inherited from class hades.simulator.SimObject
classloader, console, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
GraphicsLCD()
          GraphicsLCD(): construct a GraphicsLCD and also show the display GUI.
 
Method Summary
(package private)  void buildGUI()
           
(package private)  void buildGUICallbacks()
           
 void busyWait(double delta_t)
           
 void changeName()
           
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 SimObject copy()
          copy(): create a clone of the current GraphicsLCD, including its color
 void decode(int command)
           
 void elaborate(java.lang.Object arg)
          elaborate(): We assign a '0' to all our outputs.
 void evaluate(java.lang.Object arg)
          evaluate(): This LCD controller is sensitive to the falling edge on the enable signal (port_E) only, when the R/S, R/W, and data signals are sampled.
 java.awt.Component getPropertySheet()
          return a reference to the 'property sheet' or configuration window for this SimObject.
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message for a SimObject.
 boolean initialize(java.lang.String s)
          initialize a SimObject from a String.
static void main(java.lang.String[] argv)
          main(): simple selftest of the GraphicsLCD's GUI
 void mousePressed(java.awt.event.MouseEvent me)
          react to a MouseEvent.
 void setName(java.lang.String name)
          set the name of this SimObject.
 void setSymbol(Symbol s)
           
static void sleep(int millis)
           
 java.lang.String toString()
          toString() - the usual info method
 void wakeup(java.lang.Object arg)
          called in reaction to our busyWait calls.
 void write(java.io.PrintWriter ps)
           
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hades.simulator.Simulatable
message
 

Field Detail

debug

boolean debug

busy

protected boolean busy

command_word

protected int command_word

port_RS

protected PortStdLogic1164 port_RS

port_RW

protected PortStdLogic1164 port_RW

port_E

protected PortStdLogic1164 port_E

port_nCS1

protected PortStdLogic1164 port_nCS1

port_nCS2

protected PortStdLogic1164 port_nCS2

port_nR

protected PortStdLogic1164 port_nR

port_D7

protected PortStdLogic1164 port_D7

port_D6

protected PortStdLogic1164 port_D6

port_D5

protected PortStdLogic1164 port_D5

port_D4

protected PortStdLogic1164 port_D4

port_D3

protected PortStdLogic1164 port_D3

port_D2

protected PortStdLogic1164 port_D2

port_D1

protected PortStdLogic1164 port_D1

port_D0

protected PortStdLogic1164 port_D0

port_VO

protected PortStdLogic1164 port_VO

value_0

protected StdLogic1164 value_0

value_1

protected StdLogic1164 value_1

value_X

protected StdLogic1164 value_X

value_H

protected StdLogic1164 value_H

symbolTypeLabel

protected Label symbolTypeLabel

driver1

GraphicsLCD.KS0108 driver1

driver2

GraphicsLCD.KS0108 driver2

topFrame

javax.swing.JFrame topFrame

lcdCanvas

GraphicsLCDCanvas lcdCanvas

theIcon

java.awt.Image theIcon

NO_CS_BITS

protected static final int NO_CS_BITS
See Also:
Constant Field Values

BIT_nR

protected static final int BIT_nR
See Also:
Constant Field Values

BIT_nCS2

protected static final int BIT_nCS2
See Also:
Constant Field Values

BIT_nCS1

protected static final int BIT_nCS1
See Also:
Constant Field Values

BIT_E

protected static final int BIT_E
See Also:
Constant Field Values

BIT_RS

protected static final int BIT_RS
See Also:
Constant Field Values

BIT_RW

protected static final int BIT_RW
See Also:
Constant Field Values

BIT_D7

protected static final int BIT_D7
See Also:
Constant Field Values

BIT_D6

protected static final int BIT_D6
See Also:
Constant Field Values

BIT_D5

protected static final int BIT_D5
See Also:
Constant Field Values

BIT_D4

protected static final int BIT_D4
See Also:
Constant Field Values

BIT_D3

protected static final int BIT_D3
See Also:
Constant Field Values

BIT_D2

protected static final int BIT_D2
See Also:
Constant Field Values

BIT_D1

protected static final int BIT_D1
See Also:
Constant Field Values

BIT_D0

protected static final int BIT_D0
See Also:
Constant Field Values

t_awt_repaint_millis

public int t_awt_repaint_millis
Constructor Detail

GraphicsLCD

public GraphicsLCD()
GraphicsLCD(): construct a GraphicsLCD and also show the display GUI.

Method Detail

setSymbol

public void setSymbol(Symbol s)
Overrides:
setSymbol in class SimObject

setName

public void setName(java.lang.String name)
Description copied from class: SimObject
set the name of this SimObject. If there is a Symbol for this SimObject, we also try to set the InstanceLabel in the Symbol.

To avoid consistency problems, when the user changes a SimObject's name interactively, we also try to enforce a unique name.

Overrides:
setName in class SimObject

buildGUI

void buildGUI()

buildGUICallbacks

void buildGUICallbacks()

changeName

public void changeName()

write

public void write(java.io.PrintWriter ps)
Overrides:
write in class SimObject

initialize

public boolean initialize(java.lang.String s)
Description copied from class: SimObject
initialize a SimObject from a String. The method returns true once all required data has been read. Until then, you should repeatedly call initialize() with additional Strings.

Overrides:
initialize in class SimObject

getPropertySheet

public java.awt.Component getPropertySheet()
Description copied from class: SimObject
return a reference to the 'property sheet' or configuration window for this SimObject. We cast the return value to an AWT Component, but typically you can expect either a hades.gui.PropertySheet or an java.awt.Window (Dialog or Frame).

Overrides:
getPropertySheet in class SimObject

configure

public void configure()
Description copied from class: SimObject
create and display a 'ConfigDialog' to set the parameters for a SimObject. The default ConfigDialog for the base class (SimObject) itself is empty except for the 'instance name' of the SimObject.

Overrides:
configure in class SimObject

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Description copied from class: SimObject
react to a MouseEvent. The base SimObject ignores MouseEvents.

Note that the HADES schematic editor will also deliver jfig.canvas.FigCanvasEvent object, which also include the world-coordinates of the Event.

Overrides:
mousePressed in class SimObject

elaborate

public void elaborate(java.lang.Object arg)
elaborate(): We assign a '0' to all our outputs.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class SimObject
Parameters:
arg - This parameter is ignored by GraphicsLCD

evaluate

public void evaluate(java.lang.Object arg)
evaluate(): This LCD controller is sensitive to the falling edge on the enable signal (port_E) only, when the R/S, R/W, and data signals are sampled.

Also, note that the enable pulse duration must be at least 450 nsec, and that all commands except 'read busy flag' are ignored while the controller is busy servicing an older command.

See the data-sheet for details of controller commands and operation.

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class SimObject
Parameters:
arg - An arbitrary and unused object

decode

public void decode(int command)

copy

public SimObject copy()
copy(): create a clone of the current GraphicsLCD, including its color

Overrides:
copy in class SimObject

busyWait

public void busyWait(double delta_t)

wakeup

public void wakeup(java.lang.Object arg)
called in reaction to our busyWait calls. Clear our internal busy flag.

Specified by:
wakeup in interface Wakeable

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
Description copied from class: SimObject
construct a (short) tool tip message for a SimObject. This method should be overridden as needed.

Specified by:
getToolTip in interface ContextToolTip
Overrides:
getToolTip in class SimObject

toString

public java.lang.String toString()
toString() - the usual info method

Overrides:
toString in class SimObject

sleep

public static void sleep(int millis)

main

public static void main(java.lang.String[] argv)
main(): simple selftest of the GraphicsLCD's GUI