Author: robhamerling
Date: Sat Feb 28 12:41:41 2009
New Revision: 817

Added:
    trunk/sample/by_device/16f676/16f676_lcd_hd44780_4.jal
    trunk/sample/by_device/16f727/16F727_lcd_hd44780_8.jal
    trunk/sample/by_device/16f727/16f727_lcd_hd44780_4.jal
Modified:
    trunk/include/external/lcd/ng_hd44780_4.jal
    trunk/include/external/lcd/ng_hd44780_8.jal
    trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4.jal
    trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8.jal

Log:

  Added support for 2 nibbles as data port to library lcd_hd44780_8
  Added new samples for lcd_hd44780_4 and -8
  Updated some existing lcd samples



Modified: trunk/include/external/lcd/ng_hd44780_4.jal
==============================================================================
--- trunk/include/external/lcd/ng_hd44780_4.jal (original)
+++ trunk/include/external/lcd/ng_hd44780_4.jal Sat Feb 28 12:41:41 2009
@@ -13,9 +13,9 @@
  --    Nibble interface for HD44780 compatible alphanumeric LCD screens.
  --
  --    Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
+--         and
  --             - 1 port nibble for data: 'lcd_dataport'
---    or
---             - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
+--         or
  --             - 4 lines for data: 'lcd_d4' .. 'lcd_d7'
  --    note:    a 'port nibble' - the lower or higher 4 bits of a port -  
give
  --             faster and more compact code then random selected data  
lines.
@@ -26,33 +26,31 @@
  --          const byte LCD_ROWS     = 2              -- 1, 2 or 4 lines
  --          const byte LCD_CHARS    = 16             -- 8, 16 or 20 chars  
per line
  --       and variables (aliases):
---          var   byte lcd_dataport  is  portA_low   -- 4 data pins
  --          var   bit  lcd_en        is  pin_A4      -- trigger
  --          var   bit  lcd_rs        is  pin_A5      -- cmd/data select
---       or
+--       and variables (aliases):
+--          var   byte lcd_dataport  is  portA_low   -- 4 data pins
+--       or
  --          var   bit  lcd_d4 is     is  pin_A3      -- databit d4 pin
  --          var   bit  lcd_d5 is     is  pin_A1      -- databit d5 pin
  --          var   bit  lcd_d6 is     is  pin_C0      -- databit d6 pin
  --          var   bit  lcd_d7 is     is  pin_C2      -- databit d7 pin
---          var   bit  lcd_en        is  pin_A4      -- trigger
---          var   bit  lcd_rs        is  pin_A5      -- cmd/data select
--- --
---    2. Include this library.
  -- --
---    and somewhere before actually using the lcd:
---    3. Set the chosen LCD dataport and handshake pins to output:
---          portA_low_direction = all_output
+--    2. Set the chosen LCD dataport and handshake pins to output:
  --          pin_A4_direction    = output
  --          pin_A5_direction    = output
---    or
---          pin_A3_direction    = output -- set data pin as output
---          pin_A1_direction    = output -- set data pin as output
---          pin_C0_direction    = output -- set data pin as output
---          pin_C2_direction    = output -- set data pin as output
---          pin_A4_direction    = output -- set control pin as output
---          pin_A5_direction    = output -- set control pin as output
+--       and
+--          portA_low_direction = all_output
+--       or
+--          pin_A3_direction    = output            -- set data pin as  
output
+--          pin_A1_direction    = output            -- set data pin as  
output
+--          pin_C0_direction    = output            -- set data pin as  
output
+--          pin_C2_direction    = output            -- set data pin as  
output
+-- --
+--    3. Include this library.
  -- --
  --    4. Call lcd_init() to initialize the lcd controller.
+-- --
  --    Above is an example for a 2x16 LCD:
  -- --
  --    See hd_44780_common for the LCD API.
@@ -60,7 +58,6 @@
  -- Dependencies: delay.jal
  --
  --  
-----------------------------------------------------------------------------
---

  include delay

@@ -73,7 +70,7 @@
  procedure __lcd_write_nibble( byte in value ) is
     ;pragma inline

-   if (defined(lcd_dataport) == true) then
+   if (defined(lcd_dataport) == TRUE) then
        -- write nibble at once
           lcd_dataport = value                   -- replace low nibble
     else

Modified: trunk/include/external/lcd/ng_hd44780_8.jal
==============================================================================
--- trunk/include/external/lcd/ng_hd44780_8.jal (original)
+++ trunk/include/external/lcd/ng_hd44780_8.jal Sat Feb 28 12:41:41 2009
@@ -14,7 +14,7 @@
  --    Uses 8 bit wide datapath + 2 handshake lines (total 10 PIC pins).
  --    Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
  --             - 1 complete port for data: 'lcd_dataport'
---    or
+--    or
  --             - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
  --             - 8 lines for data: 'lcd_d0' .. 'lcd_d7'
  --    note:    a 'port nibble' - the lower or higher 4 bits of a port -  
give
@@ -26,10 +26,14 @@
  --          const byte LCD_ROWS     = 2              -- 1, 2 or 4 lines
  --          const byte LCD_CHARS    = 16             -- 8, 16 or 20 chars  
per line
  --       and variables (aliases):
+--          var   bit  lcd_rs        is  pin_D2      -- cmd/data select
+--          var   bit  lcd_en        is  pin_D3      -- trigger
+--       and variables (aliases):
  --          var   byte lcd_dataport  is  portF       -- 8 data pins
---          var   bit  lcd_en        is  pin_A2      -- trigger
---          var   bit  lcd_rs        is  pin_A3      -- cmd/data select
---       or
+--        or
+--          var   byte lcd_dataport_low  is portD_high  -- 4 low order  
data pins
+--          var   byte lcd_dataport_high is portC_high  -- 4 high order  
data pins
+--        or
  --          var   bit  lcd_d0 is     is  pin_D0      -- databit d0 pin
  --          var   bit  lcd_d1 is     is  pin_D1      -- databit d1 pin
  --          var   bit  lcd_d2 is     is  pin_C6      -- databit d2 pin
@@ -38,30 +42,30 @@
  --          var   bit  lcd_d5 is     is  pin_B1      -- databit d5 pin
  --          var   bit  lcd_d6 is     is  pin_C0      -- databit d6 pin
  --          var   bit  lcd_d7 is     is  pin_C2      -- databit d7 pin
---          var   bit  lcd_en        is  pin_A2      -- trigger
---          var   bit  lcd_rs        is  pin_A3      -- cmd/data select
  -- --
---    2. Include this library.
+--    2. Set the chosen LCD handshake pins to output:
+--          pin_D2_direction     = output
+--          pin_D3_direction     = output
+--      and the data port to output:
+--          portF_direction      = ALL_OUTPUT
+--      or 2 half data ports to output:
+--          portD_high_direction = ALL_OUTPUT
+--          portC_high_direction = ALL_OUTPUT
+--      or 8 individual pins to outout
+--          pin_D0_direction     = output -- set data pin as output
+--          pin_D1_direction     = output -- set data pin as output
+--          pin_C6_direction     = output -- set data pin as output
+--          pin_C7_direction     = output -- set data pin as output
+--          pin_B0_direction     = output -- set data pin as output
+--          pin_B1_direction     = output -- set data pin as output
+--          pin_C0_direction     = output -- set data pin as output
+--          pin_C2_direction     = output -- set data pin as output
  -- --
---    and somewhere before actually using the lcd:
---    3. Set the chosen LCD dataport and handshake pins to output:
---          portF_direction     = all_output
---          pin_A2_direction    = output
---          pin_A3_direction    = output
---    or
---          pin_D0_direction    = output -- set data pin as output
---          pin_D1_direction    = output -- set data pin as output
---          pin_C6_direction    = output -- set data pin as output
---          pin_C&_direction    = output -- set data pin as output
---          pin_B0_direction    = output -- set data pin as output
---          pin_B1_direction    = output -- set data pin as output
---          pin_C0_direction    = output -- set data pin as output
---          pin_C2_direction    = output -- set data pin as output
---          pin_A2_direction    = output -- set control pin as output
---          pin_A3_direction    = output -- set control pin as output
+--    3. Include this library.
  -- --
  --    4. Call lcd_init() to initialize the lcd controller.
---    Above is an example for a 2x16 LCD:
+-- --
+--    Above is an example for a 2x16 LCD.
  -- --
  --    See hd_44780_common for the LCD API.
  --
@@ -78,8 +82,11 @@
  --
  --  
----------------------------------------------------------------------------
  procedure __lcd_write( byte in value ) is
-   if (defined(lcd_dataport) == true) then
-      lcd_dataport = value                      -- replace low nibble
+   if (defined(lcd_dataport) == TRUE) then
+      lcd_dataport = value                      -- copy data to dataport
+   elsif (defined(lcd_dataport_low) == TRUE) then
+      lcd_dataport_low  = (value & 0x0F)        -- copy low nibble
+      lcd_dataport_high = (value >> 4)          -- copy high nibble
     else
        var bit bit0 at value : 0
        var bit bit1 at value : 1

Added: trunk/sample/by_device/16f676/16f676_lcd_hd44780_4.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f676/16f676_lcd_hd44780_4.jal      Sat Feb 28  
12:41:41 2009
@@ -0,0 +1,74 @@
+-- =======================================================================
+-- Title: Test program for LCD routines.
+--
+-- Author: Rob Hamerling, Copyright (c) 2008..2008, 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: Program to test the lcd_hd44780_4 library
+--
+-- Sources:
+--
+-- Notes:
+--
+-- -----------------------------------------------------------------------
+
+include 16f676                                  -- target
+
+pragma target clock 20_000_000                  -- resonator frequency
+
+pragma target OSC        hs
+pragma target WDT        disabled
+pragma target MCLR       external
+
+enable_digital_io()                           -- disable analog functions
+
+-- ------- LCD interface --------------------------------------------------
+
+const byte LCD_ROWS  = 2
+const byte LCD_CHARS = 16
+
+var  byte lcd_dataport    is portC_low          -- data
+var  bit  lcd_rs          is pin_C5             -- command/data select.
+var  bit  lcd_en          is pin_A2             -- data trigger
+
+include ng_hd44780_4                            -- fetch LCD library
+
+pin_A0_direction     = output                   -- )
+portC_low_direction  = all_output               -- )
+pin_A2_direction     = output                   -- } set port/pin  
directions
+pin_C5_direction     = output                   -- )
+
+lcd_init()                                      -- init the lcd controller
+
+-- ------- ----------------------------------------------------------------
+
+include delay
+
+-- ------- ----------------------------------------------------------------
+
+forever loop
+
+   var byte c[LCD_CHARS] = "0123456789ABCDEF"
+
+   var byte i,j
+
+   for LCD_ROWS using i loop
+      lcd_setcursor(i,i)
+      for LCD_CHARS using j loop
+         pin_A0 = !pin_A0
+         lcd_writechar(c[j])
+         delay_100ms(3)
+      end loop
+   end loop
+   delay_100ms(10)
+   lcd_clearscreen()
+
+end loop
+
+

Added: trunk/sample/by_device/16f727/16F727_lcd_hd44780_8.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f727/16F727_lcd_hd44780_8.jal      Sat Feb 28  
12:41:41 2009
@@ -0,0 +1,76 @@
+-- =======================================================================
+-- Title: Test program for LCD routines.
+--
+-- Author: Rob Hamerling, Copyright (c) 2008..2008, 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: Program to test the lcd_hd44780_8 library
+--
+-- Sources:
+--
+-- Notes:
+--
+-- -----------------------------------------------------------------------
+
+include 16f727                                  -- target
+
+pragma target clock 20_000_000                  -- resonator frequency
+
+pragma target OSC        hs
+pragma target WDT        disabled
+pragma target MCLR       external
+
+enable_digital_io()                           -- disable analog functions
+
+-- ------- LCD interface --------------------------------------------------
+
+const byte LCD_ROWS  = 2
+const byte LCD_CHARS = 16
+
+var  byte lcd_dataport_high  is  portD_high     -- high data nibble
+var  byte lcd_dataport_low   is  portC_high     -- low data nibble
+var  bit  lcd_rs             is  pin_D2         -- command/data select.
+var  bit  lcd_en             is  pin_D3         -- data trigger
+
+include ng_hd44780_8                            -- fetch LCD library
+
+pin_A0_direction     = output                   -- )
+portD_high_direction = all_output               -- )
+portC_high_direction = all_output               -- )
+pin_D2_direction     = output                   -- } set port/pin  
directions
+pin_D3_direction     = output                   -- )
+
+lcd_init()                                      -- init the lcd controller
+
+-- ------- ----------------------------------------------------------------
+
+include delay
+
+-- ------- ----------------------------------------------------------------
+
+forever loop
+
+   var byte c[LCD_CHARS] = "0123456789ABCDEF"
+
+   var byte i,j
+
+   for LCD_ROWS using i loop
+      lcd_setcursor(i,i)
+      for LCD_CHARS using j loop
+         pin_A0 = !pin_A0
+         lcd_writechar(c[j])
+         delay_100ms(3)
+      end loop
+   end loop
+   delay_100ms(10)
+   lcd_clearscreen()
+
+end loop
+
+

Added: trunk/sample/by_device/16f727/16f727_lcd_hd44780_4.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f727/16f727_lcd_hd44780_4.jal      Sat Feb 28  
12:41:41 2009
@@ -0,0 +1,74 @@
+-- =======================================================================
+-- Title: Test program for LCD routines.
+--
+-- Author: Rob Hamerling, Copyright (c) 2008..2008, 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: Program to test the lcd_hd44780_4 library
+--
+-- Sources:
+--
+-- Notes:
+--
+-- -----------------------------------------------------------------------
+
+include 16f727                                  -- target
+
+pragma target clock 20_000_000                  -- resonator frequency
+
+pragma target OSC        hs
+pragma target WDT        disabled
+pragma target MCLR       external
+
+enable_digital_io()                           -- disable analog functions
+
+-- ------- LCD interface --------------------------------------------------
+
+const byte LCD_ROWS  = 2
+const byte LCD_CHARS = 16
+
+var  byte lcd_dataport       is  portD_high     -- high data nibble
+var  bit  lcd_rs             is  pin_D2         -- command/data select.
+var  bit  lcd_en             is  pin_D3         -- data trigger
+
+include ng_hd44780_4                            -- fetch LCD library
+
+pin_A0_direction     = output                   -- )
+portD_high_direction = all_output               -- )
+pin_D2_direction     = output                   -- } set port/pin  
directions
+pin_D3_direction     = output                   -- )
+
+lcd_init()                                      -- init the lcd controller
+
+-- ------- ----------------------------------------------------------------
+
+include delay
+
+-- ------- ----------------------------------------------------------------
+
+forever loop
+
+   var byte c[LCD_CHARS] = "0123456789ABCDEF"
+
+   var byte i,j
+
+   for LCD_ROWS using i loop
+      lcd_setcursor(i,i)
+      for LCD_CHARS using j loop
+         pin_A0 = !pin_A0
+         lcd_writechar(c[j])
+         delay_100ms(3)
+      end loop
+   end loop
+   delay_100ms(10)
+   lcd_clearscreen()
+
+end loop
+
+

Modified: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4.jal
==============================================================================
--- trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4.jal    (original)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4.jal    Sat Feb 28  
12:41:41 2009
@@ -22,8 +22,6 @@

  pragma target clock 20_000_000                  -- resonator frequency

-pragma  bootloader long_start                   -- for TinyBootloader
-
  pragma target OSC        hs
  pragma target WDT        disabled
  pragma target MCLR       external
@@ -36,15 +34,15 @@
  const byte LCD_CHARS = 16

  var  byte lcd_dataport    is portF_high         -- data
-var  bit  lcd_rs          is pin_A3             -- command/data select.
  var  bit  lcd_en          is pin_A2             -- data trigger
-
-include lcd_hd44780_4                           -- fetch LCD library
+var  bit  lcd_rs          is pin_A3             -- command/data select.

  pin_A0_direction     = output                   -- )
  portF_high_direction = all_output               -- )
  pin_A2_direction     = output                   -- } set port/pin  
directions
  pin_A3_direction     = output                   -- )
+
+include ng_hd44780_4                            -- fetch LCD library

  lcd_init()                                      -- init the lcd controller


Modified: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8.jal
==============================================================================
--- trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8.jal    (original)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8.jal    Sat Feb 28  
12:41:41 2009
@@ -22,8 +22,6 @@

  pragma target clock 20_000_000                  -- resonator frequency

-pragma  bootloader long_start                   -- for TinyBootloader
-
  pragma target OSC        hs
  pragma target WDT        disabled
  pragma target MCLR       external
@@ -36,21 +34,20 @@
  const byte LCD_CHARS = 16

  var  byte lcd_dataport    is portF              -- data
-var  bit  lcd_rs          is pin_A3             -- command/data select.
  var  bit  lcd_en          is pin_A2             -- data trigger
-
-include lcd_hd44780_8                           -- fetch LCD library
+var  bit  lcd_rs          is pin_A3             -- command/data select.

  pin_A0_direction     = output                   -- )
  portF_direction      = all_output               -- )
  pin_A2_direction     = output                   -- } set port/pin  
directions
  pin_A3_direction     = output                   -- )

+include ng_hd44780_8                            -- fetch refactured LCD  
library
  lcd_init()                                      -- init the lcd controller

  -- ------- ----------------------------------------------------------------

-include delay
+-- include delay

  -- ------- ----------------------------------------------------------------


--~--~---------~--~----~------------~-------~--~----~
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