Author: robhamerling
Date: Tue Feb 24 12:01:58 2009
New Revision: 811

Modified:
    trunk/include/external/lcd/lcd_hd44780_common.jal
    trunk/include/external/lcd/ng_hd44780_4.jal
    trunk/include/external/lcd/ng_hd44780_8.jal

Log:

Some provisional changes to make both the 8-bit and 4-bit interface working



Modified: trunk/include/external/lcd/lcd_hd44780_common.jal
==============================================================================
--- trunk/include/external/lcd/lcd_hd44780_common.jal   (original)
+++ trunk/include/external/lcd/lcd_hd44780_common.jal   Tue Feb 24 12:01:58  
2009
@@ -10,7 +10,7 @@
  -- This file is part of jallib (http://jallib.googlecode.com)
  -- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
  --
--- Description: Common API for HD44780 based LCD
+-- Description: Common API for HD44780 based LCD
  --
  -- Sources:
  --
@@ -148,8 +148,8 @@
     pragma inline
     _lcd_write_data(data)
  end procedure
-
-
+
+
  --  
----------------------------------------------------------------------------
  -- sets the cursor of the LCD to the position in the shadow register
  -- (this routine is only used inside this file)
@@ -325,7 +325,7 @@
    for amount loop
        lcd = pattern
    end loop
-
+
    for ( LCD_CHARS - amount) loop
          lcd = " "
    end loop
@@ -363,8 +363,7 @@
  -- Initialise display
  --  
-----------------------------------------------------------------------------
  procedure _hd44780_init() is
-
-   _lcd_write_command(0b0010_1000)              -- 4-bits, 2 lines, 5x8  
font
+
     _lcd_write_command(0b0001_1100)              -- cursor move right
     _lcd_write_command(0b0000_1100)              -- display on,  
cursor,blink off
     _lcd_write_command(0b0000_0110)              -- cursor->right, no shift

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 Tue Feb 24 12:01:58 2009
@@ -63,7 +63,7 @@
  --    *
  --
  -- ;; ;; JS: check where we put this info - actually, this file is only the
--- ;; ;; driver and
+-- ;; ;; driver and
  -- ;;   Available functions for application programs:
  -- ;;     lcd_init()                             initialize the LCD  
controller
  -- ;;     lcd_clearscreen()                      clear screen, cursor home
@@ -92,19 +92,19 @@
  -- (requires no wait cycli inbetween upper and lower nibble)
  -- (this routine is only used inside this file)
  --  
----------------------------------------------------------------------------
-procedure __lcd_write_nibble( byte in value ) is
+procedure __lcd_write_nibble( byte in value ) is
     ;pragma inline
-
+
     if (defined(lcd_dataport) == true) then
        -- write nibble at once
           lcd_dataport = value                   -- replace low nibble
-   else
+   else
        -- write nibble bit by bit
       var bit bit0 at value : 0
       var bit bit1 at value : 1
       var bit bit2 at value : 2
       var bit bit3 at value : 3
-
+
       -- setup databits
       lcd_d4 = bit0
       lcd_d5 = bit1
@@ -116,7 +116,7 @@
     lcd_en = HIGH                                -- trigger on
     asm nop                                      -- delay (> 400 ns)
     lcd_en = LOW                                 -- trigger off
-
+
  end procedure
  --  
----------------------------------------------------------------------------

@@ -165,20 +165,20 @@
  --  
----------------------------------------------------------------------------
  --  
----------------------------------------------------------------------------
  --  
----------------------------------------------------------------------------
-procedure lcd_init() is
-
+procedure lcd_init() is
+
     -- first, init the interface
     lcd_rs = LOW                                 -- set to control char mode
     delay_1ms(25)                                -- power-up delay (> 15 ms)
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   __lcd_write_nibble(0b0000_0011)              -- function set
     delay_1ms(5)                                 -- > 4.1 milliseconds
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   __lcd_write_nibble(0b0000_0011)              -- function set
     delay_10us(10)                               -- > 100 �s
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   __lcd_write_nibble(0b0000_0011)              -- function set
+   delay_10us(4)                                -- > 37 �s
+   __lcd_write_nibble(0b0000_0010)              -- to 4-bit mode
     delay_10us(4)                                -- > 37 �s
-   __lcd_write_nibble(0b0000_0010)                -- to 4-bit mode
-   delay_10us(4)                                -- > 37 �s

      -- init the API
      _hd44780_init()
-end procedure
\ No newline at end of file
+end procedure

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 Tue Feb 24 12:01:58 2009
@@ -23,8 +23,8 @@
  --          const byte LCD_CHARS    = 16             -- 8, 16 or 20 chars  
per line
  --       and variables (aliases):
  --          var   byte lcd_dataport  is  portF       -- 8 data pins
---          var   bit  lcd_en        is  pin_A3      -- trigger
---          var   bit  lcd_rs        is  pin_A2      -- cmd/data select
+--          var   bit  lcd_en        is  pin_A2      -- trigger
+--          var   bit  lcd_rs        is  pin_A3      -- cmd/data select
  --
  --
  -- ------------- place this below, in your MAIN file and add to     
---------
@@ -69,7 +69,7 @@
  --    *
  --
  -- ;; ;; JS: check where we put this info - actually, this file is only the
--- ;; ;; driver and
+-- ;; ;; driver and
  -- ;;   Available functions for application programs:
  -- ;;     lcd_init()                             initialize the LCD  
controller
  -- ;;     lcd_clearscreen()                      clear screen, cursor home
@@ -99,8 +99,8 @@
  --  
----------------------------------------------------------------------------
  procedure __lcd_write( byte in value ) is
     if (defined(lcd_dataport) == true) then
-      lcd_dataport = data                          -- replace low nibble
-   else
+      lcd_dataport = value                      -- replace low nibble
+   else
        var bit bit0 at value : 0
        var bit bit1 at value : 1
        var bit bit2 at value : 2
@@ -109,7 +109,7 @@
        var bit bit5 at value : 5
        var bit bit6 at value : 6
        var bit bit7 at value : 7
-
+
         -- setup databits
        lcd_d0 = bit0
        lcd_d1 = bit1
@@ -119,8 +119,8 @@
        lcd_d5 = bit5
        lcd_d6 = bit6
        lcd_d7 = bit7
-   end if
-
+   end if
+
     lcd_en = HIGH                                -- trigger on
     asm nop                                      -- delay (> 400 ns)
     lcd_en = LOW                                 -- trigger off
@@ -160,20 +160,20 @@
  --  
----------------------------------------------------------------------------
  --  
----------------------------------------------------------------------------
  --  
----------------------------------------------------------------------------
-procedure lcd_init() is
-
+procedure lcd_init() is
+
     -- first, init the interface
     lcd_rs = LOW                                 -- set to control char mode
     delay_1ms(25)                                -- power-up delay (> 15 ms)
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   _lcd_write_command(0b0011_0000)              -- function set
     delay_1ms(5)                                 -- > 4.1 milliseconds
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   _lcd_write_command(0b0011_0000)              -- function set
     delay_10us(10)                               -- > 100 �s
-   __lcd_write_nibble(0b0000_0011)                -- function set
+   _lcd_write_command(0b0011_0000)              -- function set
+   delay_10us(4)                                -- > 37 �s
+   _lcd_write_command(0b0011_1000)              -- to 8-bit mode
     delay_10us(4)                                -- > 37 �s
-   __lcd_write_nibble(0b0000_0010)                -- to 4-bit mode
-   delay_10us(4)                                -- > 37 �s

      -- init the API
      _hd44780_init()
-end procedure
\ No newline at end of file
+end procedure

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