Display Text on a Nokia 6610 / Epson 132x132 LCD display

Download pre-release library modules and new examples to use with Astrobe for Cortex-M. Forum members can also upload their own source code examples.
Post Reply
cfbsoftware
Site Admin
Posts: 493
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Display Text on a Nokia 6610 / Epson 132x132 LCD display

Post by cfbsoftware » Thu Jun 07, 2012 1:29 pm

Main module: TextDisplay.mod

Code: Select all

MODULE TextDisplay;
(* =========================================================================  
   Example Cortex-M3 Oberon Program  
 
   Description:
     1. Write the complete character set for the font twice to a display.
        This demonstrates the automatic wrap at end of line and scrolling up 
        at the end of screen.
     2. Redirect runtime error reporting to the display and show the 
        output from a failed assertion.
     
   Astrobe for Cortex-M3 Version: 
     v4.2 or later

   Target:
     Dependent on the imported modules: Display -> LCDEpson 

   Tested on: 
     Olimex LPC1766-STK Development Prototype Board
   
   (c) 2011-2012 CFB Software   
   http://www.astrobe.com  
   
   ========================================================================= *)

IMPORT Display, Main, Out;

PROCEDURE ShowAllChars;
VAR
  ch, firstCh, lastCh: INTEGER;
BEGIN
  firstCh := ORD(" ");
  lastCh := ORD("~");
  FOR ch := firstCh TO lastCh DO 
    Display.Char(CHR(ch))
  END;
  Display.Ln()
END ShowAllChars;


PROCEDURE Run;
VAR
  i: INTEGER;
BEGIN
  Display.Init();
  FOR i := 1 TO 2 DO ShowAllChars() END;
  (* Redirect debug output to display *)
  Out.Init(Display.Char);
  (* Display a debug message *)
  ASSERT(FALSE, 100)
END Run;

BEGIN
  Run
END TextDisplay.
Display.mod

Code: Select all

MODULE Display;
(* =========================================================================
   Example ARM Oberon Module

   Description:
     Write line-oriented output to an LCD display

   Target:
     Dependent on the imported module: LCD

   Tested on:
     Olimex LPC1766-STK Development Prototype Board

   (c) 2011-2012 CFB Software
   http://www.astrobe.com

   ========================================================================= *)

IMPORT LCD := LCDEpson, Fonts;

CONST
  LF = 0AX;

TYPE
  Row = ARRAY LCD.MaxCol OF CHAR;
  Screen = ARRAY LCD.MaxRow OF Row;

VAR
  rowNo, colNo: INTEGER;
  screen: Screen;
  blankRow: Row;

PROCEDURE WriteChar(ch: CHAR; r, c: INTEGER);
BEGIN
  LCD.DrawChar(LCD.White, ch, c * 8, r * 10 + 2)
END WriteChar;


PROCEDURE WriteRow(row: Row);
VAR
  c: INTEGER;
BEGIN
  FOR c := 0 TO LCD.MaxCol - 1 DO
    WriteChar(row[c], rowNo, c)
  END
END WriteRow;


PROCEDURE ScrollUp;
VAR
  r: INTEGER;
BEGIN
  (* Move rows up *)
  FOR r := 1 TO LCD.MaxRow - 1 DO
    rowNo := r - 1;
    screen[rowNo] := screen[r];
    WriteRow(screen[rowNo])
  END;
  rowNo := LCD.MaxRow - 1;
  colNo := 0;
  screen[rowNo] := blankRow
END ScrollUp;


PROCEDURE Ln*();
BEGIN
  IF rowNo < LCD.MaxRow - 1 THEN
    WriteRow(screen[rowNo]);
    INC(rowNo);
    colNo := 0;
    screen[rowNo] := blankRow
  ELSE
    ScrollUp
  END
END Ln;


PROCEDURE Char*(ch: CHAR);
BEGIN
  IF ch = LF THEN
    Ln
  ELSIF ch >= " " THEN
    screen[rowNo, colNo] := ch;
    INC(colNo);
    IF colNo = LCD.MaxCol THEN Ln END
  END
END Char;


PROCEDURE String*(s: ARRAY OF CHAR);
VAR
  i: INTEGER;
BEGIN
  i := 0;
  WHILE (i < LEN(s)) & (s[i] # 0X) DO Char(s[i]); INC(i) END
END String;


PROCEDURE Init*();
BEGIN
  LCD.Init();
  ASSERT(LCD.LoadFont("Fonts"), 100);
  LCD.ClearScreen(LCD.Black)
END Init;

BEGIN
  (* Initialise the memory representation of the screen *)
  FOR colNo := 0 TO LCD.MaxCol - 1 DO blankRow[colNo] := " " END;
  FOR rowNo := 0 TO LCD.MaxRow - 1 DO screen[rowNo] := blankRow END;
  rowNo := 0;
  colNo := 0
END Display.
LCDEpson.def

Code: Select all

DEFINITION MODULE LCDEpson;
(* =========================================================================  
   Epson S1D15G00 LCD Controller Driver for 132x132 LCD Nokia-type display

   Reference:
     Seiko Epson S1D15G00 Series DataSheet Rev 1.0 2001.
     
   (c) 2009-2012 CFB Software
   http://www.astrobe.com
   
   ========================================================================= *)
IMPORT Timer, MCU, ResData, SPI, SYSTEM;

CONST 
  (* 12-bit color definitions *)
  White*   = 0FFFH;
  Black*   = 0000H;
  Red*     = 0F00H;
  Green*   = 00F0H;
  Blue*    = 000FH;
  Cyan*    = 00FFH;
  Magenta* = 0F0FH;
  Yellow*  = 0FF0H;
  Brown*   = 0B22H;
  Orange*  = 0FA0H;
  Pink*    = 0F6AH;
  
  MaxX* = 131;
  MaxY* = 131;
  
  (* 8 x 10 font *)
  MaxCol* = MaxX DIV 8;
  MaxRow* = MaxY DIV 10;

  PROCEDURE LoadFont*(name: ARRAY OF CHAR): BOOLEAN;

 (* ************************************************************************************* *)
 (* Draws two dots in the specified color at the specified x and y coordinates *)
 (* color = 12-bit color value xxxxrrrrggggbbbb *)
 (* 0000 colour is off, 1111 colour is full on *)
  PROCEDURE DrawDot*(colour, x, y: INTEGER);

  PROCEDURE FillRectangle*(colour, x1, y1, x2, y2: INTEGER);

  PROCEDURE DrawChar*(colour: INTEGER; ch: CHAR; x1, y1: INTEGER);

  PROCEDURE ClearScreen*(Colour: INTEGER);
  
  PROCEDURE Init*;
  
END LCDEpson.
Attachments
TextDisplay.zip
TextDisplay.mod, Display.mod, LCDEpson.def, LPCEpson.mod, Fonts.mod, Fonts.res
(5.81 KiB) Downloaded 997 times

Post Reply