Revision: 1713
Author: jsuijs
Date: Sat Feb 27 05:14:18 2010
Log: graphic lcd test & sample files (still beta, test file has pin definitions)
http://code.google.com/p/jallib/source/detail?r=1713

Added:
 /trunk/sample/16f877_glcd.jal
 /trunk/sample/16f877a_glcd.jal
 /trunk/sample/18f4550_glcd.jal
 /trunk/test/external/lcd/test_glcd.jal
Modified:
 /trunk/include/external/lcd/glcd_common.jal
 /trunk/include/external/lcd/lcd_ks0108.jal

=======================================
--- /dev/null
+++ /trunk/sample/16f877_glcd.jal       Sat Feb 27 05:14:18 2010
@@ -0,0 +1,99 @@
+-- Title: Test program for i2c hardware slave, message interface implementation
+-- Author: Joep Suijs, Copyright (c) 2008-2009, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4i
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: this sample shows how to implements an i2c hardware slave,
+-- using the message interface lib. Basically, this i2c slave waits for
+-- a full message to arrive and then calls a user routine to process the message and
+-- (optional) prepare a response.
+--
+--
+-- This file has been generated from:
+--    * board: board_16f877_dwarf.jal
+--    * test : test_glcd.jal
+--
+
+;@jallib section chipdef
+-- chip setup
+include 16f877
+
+pragma target clock 20_000_000                  -- xtal frequency
+pragma target OSC        hs
+pragma target   LVP disabled
+pragma target   WDT disabled
+
+
+
+;@jallib section glcd
+-- GRAPHIC_LCD IO definition
+var volatile byte GLCD_DATAPRT     is portd
+var volatile byte GLCD_DATAPRT_DIR is portd_direction
+
+var volatile bit GLCD_RW  is pin_b4
+var volatile bit GLCD_CS1 is pin_b0
+var volatile bit GLCD_E   is pin_b5
+var volatile bit GLCD_DI  is pin_b2
+var volatile bit GLCD_RST is pin_c0
+var volatile bit GLCD_CS2 is pin_b1
+
+var volatile bit GLCD_RW_DIRECTION  is pin_b4_direction
+var volatile bit GLCD_CS1_DIRECTION is pin_b0_direction
+var volatile bit GLCD_E_DIRECTION   is pin_b5_direction
+var volatile bit GLCD_DI_DIRECTION  is pin_b2_direction
+var volatile bit GLCD_RST_DIRECTION is pin_c0_direction
+var volatile bit GLCD_CS2_DIRECTION is pin_b1_direction
+
+;@jallib section led
+-- LED IO definition
+alias led             is pin_b6
+alias led_direction   is pin_b6_direction
+alias led2            is pin_a1
+alias led2_direction  is pin_a1_direction
+led_direction = output
+
+-- setup serial (see echo.jal for more details);@jallib section serial
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+
+include print
+
+
+include delay
+include lcd_ks0108
+include glcd_common
+lcd_init()
+
+const byte str1[] = "Test graph display.      "      -- define a string
+print_string(serial_hw_data, str1)                 -- output string
+
+lcd_box  ( 0,0, 127,63)
+
+include print
+
+glcd_char_y_pos  = 20;
+glcd_char_x_pos = 20
+forever loop
+
+   delay_100ms(5)
+;    line(0, 0, 64, 64)
+;   print_string(lcd, str1)
+;   glcd_box  ( 0,0, 127,63)
+
+   var byte x, y, char;
+   char = 32
+   for 9 using y loop
+      for 25 using x loop
+         lcd_setcursor(y, x)
+         lcd = char
+         char = char + 1
+         if (char > 122) then char = 32 end if
+      end loop
+   end loop
+
+
+end loop
=======================================
--- /dev/null
+++ /trunk/sample/16f877a_glcd.jal      Sat Feb 27 05:14:18 2010
@@ -0,0 +1,97 @@
+-- Title: Test program for i2c hardware slave, message interface implementation
+-- Author: Joep Suijs, Copyright (c) 2008-2009, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4i
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: this sample shows how to implements an i2c hardware slave,
+-- using the message interface lib. Basically, this i2c slave waits for
+-- a full message to arrive and then calls a user routine to process the message and
+-- (optional) prepare a response.
+--
+--
+-- This file has been generated from:
+--    * board: board_16f877a_startersguide.jal
+--    * test : test_glcd.jal
+--
+
+;@jallib section chipdef
+-- chip setup
+include 16f877a
+
+pragma target clock 20_000_000                  -- xtal frequency
+pragma target OSC        hs
+pragma target   LVP disabled
+pragma target   WDT disabled
+
+
+
+;@jallib section glcd
+-- GRAPHIC_LCD IO definition
+var volatile byte GLCD_DATAPRT     is portd
+var volatile byte GLCD_DATAPRT_DIR is portd_direction
+
+var volatile bit GLCD_RW  is pin_b4
+var volatile bit GLCD_CS1 is pin_b0
+var volatile bit GLCD_E   is pin_b5
+var volatile bit GLCD_DI  is pin_b2
+var volatile bit GLCD_RST is pin_c0
+var volatile bit GLCD_CS2 is pin_b1
+
+var volatile bit GLCD_RW_DIRECTION  is pin_b4_direction
+var volatile bit GLCD_CS1_DIRECTION is pin_b0_direction
+var volatile bit GLCD_E_DIRECTION   is pin_b5_direction
+var volatile bit GLCD_DI_DIRECTION  is pin_b2_direction
+var volatile bit GLCD_RST_DIRECTION is pin_c0_direction
+var volatile bit GLCD_CS2_DIRECTION is pin_b1_direction
+
+;@jallib section led
+-- LED IO definition
+alias led             is pin_c2
+alias led_direction   is pin_c2_direction
+led_direction = output
+
+-- setup serial (see echo.jal for more details);@jallib section serial
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+
+include print
+
+
+include delay
+include lcd_ks0108
+include glcd_common
+lcd_init()
+
+const byte str1[] = "Test graph display.      "      -- define a string
+print_string(serial_hw_data, str1)                 -- output string
+
+lcd_box  ( 0,0, 127,63)
+
+include print
+
+glcd_char_y_pos  = 20;
+glcd_char_x_pos = 20
+forever loop
+
+   delay_100ms(5)
+;    line(0, 0, 64, 64)
+;   print_string(lcd, str1)
+;   glcd_box  ( 0,0, 127,63)
+
+   var byte x, y, char;
+   char = 32
+   for 9 using y loop
+      for 25 using x loop
+         lcd_setcursor(y, x)
+         lcd = char
+         char = char + 1
+         if (char > 122) then char = 32 end if
+      end loop
+   end loop
+
+
+end loop
=======================================
--- /dev/null
+++ /trunk/sample/18f4550_glcd.jal      Sat Feb 27 05:14:18 2010
@@ -0,0 +1,142 @@
+-- Title: Test program for i2c hardware slave, message interface implementation
+-- Author: Joep Suijs, Copyright (c) 2008-2009, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4i
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: this sample shows how to implements an i2c hardware slave,
+-- using the message interface lib. Basically, this i2c slave waits for
+-- a full message to arrive and then calls a user routine to process the message and
+-- (optional) prepare a response.
+--
+--
+-- This file has been generated from:
+--    * board: board_18f4550_af.jal
+--    * test : test_glcd.jal
+--
+
+;@jallib section chipdef
+-- chip setup
+include 18f4550
+
+-- even though the external crystal is 20 MHz, the configuration is such that
+-- the CPU clock is derived from the 96 Mhz PLL clock (div2), therefore set
+-- target frequency to 48 MHz
+pragma target clock       48_000_000
+
+
+-- fuses
+pragma target PLLDIV        P5          -- divide by 5 - 20MHZ_INPUT
+pragma target CPUDIV        P2          -- OSC1_OSC2_SRC_1_96MHZ_PLL_SRC_2
+pragma target USBPLL        F48MHZ      -- CLOCK_SRC_FROM_96MHZ_PLL_2
+pragma target OSC           HS_PLL
+pragma target FCMEN         DISABLED
+pragma target IESO          DISABLED
+pragma target PWRTE         DISABLED    -- power up timer
+pragma target VREGEN        ENABLED     -- USB voltage regulator
+pragma target VOLTAGE       V20         -- brown out voltage
+pragma target BROWNOUT      DISABLED    -- no brownout detection
+pragma target WDTPS         P32K        -- watch dog saler setting
+pragma target WDT           DISABLED    -- no watchdog
+pragma target CCP2MUX       pin_C1      -- CCP2 pin
+pragma target PBADEN        DIGITAL     -- digital input port<0..4>
+pragma target LPT1OSC       LOW_POWER   -- low power timer 1
+pragma target MCLR          EXTERNAL    -- master reset on RE3
+pragma target STVR          DISABLED    -- reset on stack over/under flow
+pragma target LVP           DISABLED    -- no low-voltage programming
+pragma target XINST         ENABLED     -- extended instruction set
+pragma target DEBUG         DISABLED    -- background debugging
+pragma target CP0           DISABLED    -- code block 0 not protected
+pragma target CP1           DISABLED    -- code block 1 not protected
+pragma target CP2           DISABLED    -- code block 2 not protected
+pragma target CP3           DISABLED    -- code block 3 not protected
+pragma target CPB DISABLED -- bootblock code not write protected
+pragma target CPD           DISABLED    -- eeprom code not write protected
+pragma target WRT0          DISABLED    -- table writeblock 0 not protected
+pragma target WRT1 DISABLED -- table write block 1 not protected +pragma target WRT2 DISABLED -- table write block 2 not protected +pragma target WRT3 DISABLED -- table write block 3 not protected
+pragma target WRTB          DISABLED    -- bootblock not write protected
+pragma target WRTD          DISABLED    -- eeprom not write protected
+pragma target WRTC          DISABLED    -- config not write protected
+pragma target EBTR0         DISABLED    -- table read block 0 not protected
+pragma target EBTR1         DISABLED    -- table read block 1 not protected
+pragma target EBTR2         DISABLED    -- table read block 2 not protected
+pragma target EBTR3         DISABLED    -- table read block 3 not protected
+pragma target EBTRB         DISABLED    -- boot block not protected
+
+
+
+
+;@jallib section glcd
+-- GRAPHIC_LCD IO definition
+var volatile byte GLCD_DATAPRT     is portd
+var volatile byte GLCD_DATAPRT_DIR is portd_direction
+
+var volatile bit GLCD_RW  is pin_b4
+var volatile bit GLCD_CS1 is pin_b0
+var volatile bit GLCD_E   is pin_b5
+var volatile bit GLCD_DI  is pin_b2
+var volatile bit GLCD_RST is pin_c0
+var volatile bit GLCD_CS2 is pin_b1
+
+var volatile bit GLCD_RW_DIRECTION  is pin_b4_direction
+var volatile bit GLCD_CS1_DIRECTION is pin_b0_direction
+var volatile bit GLCD_E_DIRECTION   is pin_b5_direction
+var volatile bit GLCD_DI_DIRECTION  is pin_b2_direction
+var volatile bit GLCD_RST_DIRECTION is pin_c0_direction
+var volatile bit GLCD_CS2_DIRECTION is pin_b1_direction
+
+;@jallib section led
+-- LED IO definition
+alias led is pin_b3
+alias led_direction is pin_b3_direction
+alias led2 is pin_b1
+alias led2_direction is pin_b1_direction
+led_direction = output
+
+-- setup serial (see echo.jal for more details);@jallib section serial
+const serial_hw_baudrate = 115_200
+
+include serial_hardware
+serial_hw_init()
+
+include print
+
+
+include delay
+include lcd_ks0108
+include glcd_common
+lcd_init()
+
+const byte str1[] = "Test graph display.      "      -- define a string
+print_string(serial_hw_data, str1)                 -- output string
+
+lcd_box  ( 0,0, 127,63)
+
+include print
+
+glcd_char_y_pos  = 20;
+glcd_char_x_pos = 20
+forever loop
+
+   delay_100ms(5)
+;    line(0, 0, 64, 64)
+;   print_string(lcd, str1)
+;   glcd_box  ( 0,0, 127,63)
+
+   var byte x, y, char;
+   char = 32
+   for 9 using y loop
+      for 25 using x loop
+         lcd_setcursor(y, x)
+         lcd = char
+         char = char + 1
+         if (char > 122) then char = 32 end if
+      end loop
+   end loop
+
+
+end loop
=======================================
--- /dev/null
+++ /trunk/test/external/lcd/test_glcd.jal      Sat Feb 27 05:14:18 2010
@@ -0,0 +1,84 @@
+-- Title: Test program for i2c hardware slave, message interface implementation
+-- Author: Joep Suijs, Copyright (c) 2008-2009, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4i
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: this sample shows how to implements an i2c hardware slave,
+-- using the message interface lib. Basically, this i2c slave waits for
+-- a full message to arrive and then calls a user routine to process the message and
+-- (optional) prepare a response.
+--
+
+;@jallib use chipdef
+
+
+
+;@jallib section glcd
+-- GRAPHIC_LCD IO definition
+var volatile byte GLCD_DATAPRT     is portd
+var volatile byte GLCD_DATAPRT_DIR is portd_direction
+
+var volatile bit GLCD_RW  is pin_b4
+var volatile bit GLCD_CS1 is pin_b0
+var volatile bit GLCD_E   is pin_b5
+var volatile bit GLCD_DI  is pin_b2
+var volatile bit GLCD_RST is pin_c0
+var volatile bit GLCD_CS2 is pin_b1
+
+var volatile bit GLCD_RW_DIRECTION  is pin_b4_direction
+var volatile bit GLCD_CS1_DIRECTION is pin_b0_direction
+var volatile bit GLCD_E_DIRECTION   is pin_b5_direction
+var volatile bit GLCD_DI_DIRECTION  is pin_b2_direction
+var volatile bit GLCD_RST_DIRECTION is pin_c0_direction
+var volatile bit GLCD_CS2_DIRECTION is pin_b1_direction
+
+
+;@jallib use led
+led_direction = output
+
+-- setup serial (see echo.jal for more details)
+;@jallib use serial
+include serial_hardware
+serial_hw_init()
+
+include print
+
+
+include delay
+include lcd_ks0108
+include glcd_common
+lcd_init()
+
+const byte str1[] = "Test graph display.      "      -- define a string
+print_string(serial_hw_data, str1)                 -- output string
+
+lcd_box  ( 0,0, 127,63)
+
+include print
+
+glcd_char_y_pos  = 20;
+glcd_char_x_pos = 20
+forever loop
+
+   delay_100ms(5)
+;    line(0, 0, 64, 64)
+;   print_string(lcd, str1)
+;   glcd_box  ( 0,0, 127,63)
+
+   var byte x, y, char;
+   char = 32
+   for 9 using y loop
+      for 25 using x loop
+         lcd_setcursor(y, x)
+         lcd = char
+         char = char + 1
+         if (char > 122) then char = 32 end if
+      end loop
+   end loop
+
+
+end loop
+
=======================================
--- /trunk/include/external/lcd/glcd_common.jal Sun Apr  5 14:17:08 2009
+++ /trunk/include/external/lcd/glcd_common.jal Sat Feb 27 05:14:18 2010
@@ -47,6 +47,8 @@
 -- ----------------------------------------------------------
 -- ----------------------------------------------------------
 procedure lcd_box(byte in x0, byte in y0, byte in x1, byte in y1) is
+   pragma inline
+
    lcd_line ( x0,y0, x1,y0 )
    lcd_line ( x1,y0, x1,y1 )
    lcd_line ( x1,y1, x0,y1 )
@@ -66,14 +68,15 @@
     glcd_char_x_pos = glcd_char_x_pos + 5
 end procedure

--- ----------------------------------------------------------
--- Send byte to the LCD and automatically set the cursor one
--- position right.
--- There is no check on line overflow.
--- ----------------------------------------------------------
-procedure  lcd_writechar(byte in c) is
-   lcd = c
-end procedure
+;-- ----------------------------------------------------------
+;-- Send byte to the LCD and automatically set the cursor one
+;-- position right.
+;-- There is no check on line overflow.
+;-- ----------------------------------------------------------
+;procedure  lcd_writechar(byte in c) is
+;   _warn "lcd_writechar() is deprecated - please use lcd_write_char()"
+;   lcd = c
+;end procedure

 -- ------------------------------------------------------------
 -- Clear screen
@@ -97,7 +100,7 @@
-- ----------------------------------------------------------------------------
 -- cursor returns home(line 1, position 1)
-- ----------------------------------------------------------------------------
-procedure lcd_home()  is
+procedure lcd_home()  is
    glcd_char_y_pos = 0
    glcd_char_x_pos = 0
 end procedure
=======================================
--- /trunk/include/external/lcd/lcd_ks0108.jal  Sun Apr  5 14:17:08 2009
+++ /trunk/include/external/lcd/lcd_ks0108.jal  Sat Feb 27 05:14:18 2010
@@ -12,7 +12,19 @@
 --
 --
 -- Notes:
---
+--
+
+-- ----------------------------------------------------------------------------
+-- technical (library internal) details
+-- An 128x64 graphic LCD consists of 2 controllers (KS0108_LEFT and KS0108_RIGHT),
+-- each take care of 64x64 bits.
+--
+-- A byte of data represents a column of 8 bits, so the vertical 64 bits are
+-- represented by 8 bytes.
+--
+--
+-- ----------------------------------------------------------------------------
+
 const KS0108_LEFT          = 0
 const KS0108_RIGHT         = 1
 const KS0108_CMD_ON        = 0x3F
@@ -21,9 +33,12 @@
 const KS0108_CMD_COLUMN    = 0x40
 const KS0108_CMD_TOP_RAM   = 0xC0

--- Purpose:    Write a byte of data to the specified chip
--- Inputs:     1) chipSelect - which chip to write the data to
+-- ----------------------------------------------------------------------------
+-- _ks0108_write - Write a byte of data to the specified chip
+-- ----------------------------------------------------------------------------
+-- Inputs:     1) side - which chip to write the data to
 --             2) data - the byte of data to write
+-- ----------------------------------------------------------------------------
 procedure _ks0108_write(byte in side, byte in data) is
    if side == 1 then          -- Choose which side to write to
       GLCD_CS2 = high
@@ -33,21 +48,23 @@
    GLCD_RW = low        -- Set for writing
    GLCD_DATAPRT = data     -- Put the data on the port
    GLCD_DATAPRT_DIR = all_output
+
    asm nop asm nop      -- delay_cycles(1)
    GLCD_E = high        -- Pulse the enable pin
-   ;asm nop asm nop asm nop asm nop asm nop
-   ;asm nop asm nop asm nop asm nop asm nop
    delay_2us()
+
    GLCD_E = low
    GLCD_CS1 = low       -- Reset the chip select lines
    GLCD_CS2 = low
    delay_2us()
-;   asm nop asm nop asm nop asm nop asm nop
-;   asm nop asm nop asm nop asm nop asm nop
+
 end procedure

+-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
 -- Purpose:    Reads a byte of data from the specified chip
 -- Ouputs:     A byte of data read from the chip
+-- ----------------------------------------------------------------------------
 function _ks0108_read(byte in side) return byte  is
    var byte data                  -- Stores the data read from the LCD
    GLCD_DATAPRT_DIR = all_input           -- Set port d to input
@@ -62,62 +79,85 @@
    asm nop  asm nop     --  delay_cycles(1)
    GLCD_E = high        -- Pulse the enable pin

-   asm nop asm nop asm nop asm nop asm nop
-   asm nop asm nop asm nop asm nop asm nop
+   delay_2us()
data = GLCD_DATAPRT -- Get the data from the display's output register
    GLCD_E = low

    GLCD_CS1 = low       -- Reset the chip select lines
    GLCD_CS2 = low
-   asm nop asm nop asm nop asm nop asm nop
-   asm nop asm nop asm nop asm nop asm nop
+   delay_2us()

    return data          -- Return the read data
 end function

+-- ----------------------------------------------------------------------------
 -- Purpose:    Turn the display on
+-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
 procedure lcd_on() is
     _ks0108_write(KS0108_LEFT,  KS0108_CMD_ON)
     _ks0108_write(KS0108_RIGHT, KS0108_CMD_ON)
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Turn the display off
+-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
 procedure lcd_off() is
     _ks0108_write(KS0108_LEFT,  KS0108_CMD_OFF)
     _ks0108_write(KS0108_RIGHT, KS0108_CMD_OFF)
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Set the page number
+-- ----------------------------------------------------------------------------
 -- Inputs:     A page number (0 - 7)
-procedure _ks0108_page(byte in side , byte in page) is
-    _ks0108_write(side, KS0108_CMD_PAGE | page)
+-- ----------------------------------------------------------------------------
+procedure _ks0108_page(byte in side , byte in page) is
+   pragma inline
+   _ks0108_write(side, KS0108_CMD_PAGE | page)
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Set the column address
+-- ----------------------------------------------------------------------------
 -- Inputs:     The column address (0 - 63)
-procedure _ks0108_column(byte in side, byte in column) is
+-- ----------------------------------------------------------------------------
+procedure _ks0108_column(byte in side, byte in column) is
+   pragma inline
    _ks0108_write(side, KS0108_CMD_COLUMN | column)
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Specify reads and writes are instructions
-procedure _ks0108_inst() is
+-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
+procedure _ks0108_inst() is
    GLCD_DI = low
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Specify reads and writes are data
+-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
 procedure  _ks0108_data() is
    GLCD_DI = high
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Turn a pixel on a graphic LCD on or off
+-- ----------------------------------------------------------------------------
 -- Inputs:     1) x - the x coordinate of the pixel
 --             2) y - the y coordinate of the pixel
 --             3) color - ON or OFF
-procedure lcd_write_pixel(byte in x, byte in y, bit in onoff) is
+-- ----------------------------------------------------------------------------
+procedure lcd_write_pixel(byte in x, byte in y, bit in onoff) is
+   pragma inline
+
    var byte data , yy
    var byte side = KS0108_LEFT   -- Stores which chip to use on the LCD

-   if x > 63 then              -- Check for first or second display area
+   if x > 63 then                -- Check for first or second display area
       x = x - 64
       side = KS0108_RIGHT
    end if
@@ -144,6 +184,9 @@
    _ks0108_write(side, data)       -- Write the pixel data
 end procedure

+-- ---------------------------------------------------------------------------- +-- ---------------------------------------------------------------------------- +-- ----------------------------------------------------------------------------
 procedure _ks0108_write_byte(byte in x, byte in y, byte in veri) is
    var byte side = KS0108_LEFT   -- Stores which chip to use on the LCD

@@ -160,21 +203,24 @@
     _ks0108_write(side, ! veri)   -- Write the pixel data
 end procedure

+-- ----------------------------------------------------------------------------
 -- Purpose:    Fill the LCD screen with the passed in color
+-- ----------------------------------------------------------------------------
 -- Inputs:     ON  - turn all the pixels on
 --             OFF - turn all the pixels off
+-- ----------------------------------------------------------------------------
 procedure lcd_fill(byte in data) is
    var byte i, j
-   i = 0                            -- Loop through the vertical pages
+   i = 0                               -- Loop through the vertical pages
    for 8 loop
       _ks0108_inst()                   -- Set for instruction
-      _ks0108_page(KS0108_LEFT,i)    -- Set page address
+      _ks0108_page(KS0108_LEFT,i)      -- Set page address
       _ks0108_page(KS0108_RIGHT,i)
-      _ks0108_column(KS0108_LEFT,0)  -- Set horizontal address to 0
+      _ks0108_column(KS0108_LEFT,0)    -- Set horizontal address to 0
       _ks0108_column(KS0108_RIGHT,0)
       _ks0108_data()                   -- Set for data

-      -- Loop through the horizontal sections
+      -- Loop through the horizontal sections (left to right)
       for 64 loop
           _ks0108_write(KS0108_LEFT ,data)   -- Write the byte of data
           _ks0108_write(KS0108_RIGHT,data)
@@ -183,9 +229,14 @@
    end loop
 end procedure

--- Purpose:       Initialize the LCD.
---                Call before using any other LCD function.
-procedure lcd_init() is
+-- ----------------------------------------------------------------------------
+-- lcd_init - Initialize the graphic LCD.
+-- ----------------------------------------------------------------------------
+-- Call before using any other LCD function.
+-- ----------------------------------------------------------------------------
+procedure lcd_init() is
+   pragma inline
+
    -- Initialze some pins

    GLCD_DATAPRT = 0x00
@@ -215,7 +266,11 @@
 end procedure


-; 91 * 5 bytes = 455
+-- ----------------------------------------------------------------------------
+-- _font_5x7_table[] - character table
+-- ----------------------------------------------------------------------------
+-- 91 * 5 bytes = 455
+-- ----------------------------------------------------------------------------
 const byte _font_5x7_table[] = {
    0x00, 0x00, 0x00, 0x00, 0x00,    ;; space, 32
    0x00, 0x00, 0x2f, 0x00, 0x00,    ;; !,  33
@@ -311,9 +366,13 @@

 }

-;; Writes an inverted character to the display
-;; note: the vertical position of chars is in 8-bit steps.
+-- ----------------------------------------------------------------------------
+-- lcd_write_char - Writes an inverted character to the display
+-- ----------------------------------------------------------------------------
+-- note: the vertical position of chars is in 8-bit steps.
+-- ----------------------------------------------------------------------------
 procedure lcd_write_char(byte in x, byte in y, byte in ch ) is
+  pragma inline
   var word indx = 0
   var byte cx

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to