Revision: 1650
Author: [email protected]
Date: Tue Feb  2 12:38:49 2010
Log: Removed procedure lcd_init () from lcd_hd44780_common because dog_m initialization is not the same as hd44780 and therefore can not be combined in lcd__hd44780_common.
better to place complete initialisation back to the original hd44780 files.
Changed procedure lcd_init in lcd_hd44780_4, lcd_hd44780_8 and lcd_hd44780_serial_sw

changed procedure lcd_init in lcd_dog_m_spi.jal, lcd/lcd_dog_m_4.jal and lcd/lcd_dog_m_8.jal
http://code.google.com/p/jallib/source/detail?r=1650

Modified:
 /trunk/include/external/lcd/lcd_dog_m_4.jal
 /trunk/include/external/lcd/lcd_dog_m_8.jal
 /trunk/include/external/lcd/lcd_dog_m_spi.jal
 /trunk/include/external/lcd/lcd_hd44780_4.jal
 /trunk/include/external/lcd/lcd_hd44780_8.jal
 /trunk/include/external/lcd/lcd_hd44780_common.jal
 /trunk/include/external/lcd/lcd_hd44780_serial_sw.jal

=======================================
--- /trunk/include/external/lcd/lcd_dog_m_4.jal Mon Mar 16 02:14:57 2009
+++ /trunk/include/external/lcd/lcd_dog_m_4.jal Tue Feb  2 12:38:49 2010
@@ -159,15 +159,20 @@
_lcd_write_command( 0b_0010_1001 ) -- function 4bit N=1,5x7dots IS1=1
        _lcd_write_command( 0b_0001_0101 )              -- BIAS  3 line setting
     end if
-
-    _lcd_write_command( 0b_0111_0000 )                 -- contrast set
-    _lcd_write_command( 0b_0101_1110 )                 -- power/ICON/contrast 
control
-    _lcd_write_command( 0b_0110_1010 )                 -- follower control
- delay_1ms( 210 ) -- extra delay to let display settle
-
-    -- init the API
-    _hd44780_init()
-
+       _lcd_write_Command( 0b_0111_0000 ) -- contrast set
+       delay_10uS( 3)                    -- extra delay
+       _lcd_write_Command( 0b_0101_1110 ) -- power/ICON/contrast control
+       delay_10uS( 3 )
+       _lcd_write_Command( 0b_0110_1010 ) -- follower control
+ delay_1mS( 210 ) -- extra delay to let display settle
+       _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+       delay_10uS ( 3 )                      -- extra delay
+       _lcd_write_Command( 0b_0000_1100 )-- display on/off control
+          delay_10us( 3 )
+       _lcd_write_Command( 0b_0000_0001 )-- clear display
+          delay_10us( 40 )
+ _lcd_write_Command( 0b_0000_0110 )-- entry mode set, cursor moves to right
+          delay_10us( 40 )
 end procedure


=======================================
--- /trunk/include/external/lcd/lcd_dog_m_8.jal Mon Mar 16 02:14:57 2009
+++ /trunk/include/external/lcd/lcd_dog_m_8.jal Tue Feb  2 12:38:49 2010
@@ -42,15 +42,15 @@
 --    Available functions for application programs:
 --
 --
---      __lcd_write(<byte>)                     sends byte from value to
+--      _lcd_write(<byte>)                     sends byte from value to
 --                                             register of the lcd  and
-- shift cursor position 1 right
 --
 --      _lcd_write_data(<byte>)                write data to lcd using
--- __lcd_write(<byte>) lcd_rs high +-- _lcd_write(<byte>) lcd_rs high
 --
 --      _lcd_write_command(<byte>)             write command to lcd using
--- __lcd_write(<byte>) lcd_rs low +-- _lcd_write(<byte>) lcd_rs low
 --
-- lcd_init() initialize the LCD controller
 --
@@ -85,8 +85,7 @@
 -- Send byte to the LCD and automatically set the cursor
 -- one position right.
 -- ----------------------------------------------------------
-procedure  __lcd_write(byte in value) is
---   pragma inline
+procedure  _lcd_write(byte in value) is
    lcd_dataport = value                         -- replace low nibble
    lcd_en = high                                -- trigger on
    asm nop                                      -- delay (> 400 ns)
@@ -98,24 +97,24 @@

-- ----------------------------------------------------------------------------
 -- sends data byte in value to LCD
---
+-- for slow commands an extra delay should be added --
-- ----------------------------------------------------------------------------
 procedure _lcd_write_data(byte in value) is
---   pragma inline
-    lcd_rs = high                                                      -- 
select data
-    __lcd_write( value )                               -- output byte
+    lcd_rs = high                                                      -- 
select instruction
+    _lcd_write( value )                                -- output byte
 end procedure
 ---------------------------------------------------------------------------


-- ----------------------------------------------------------------------------
 -- sends command byte in value to LCD
---
+-- for slow commands an extra delay should be added
+--
-- ----------------------------------------------------------------------------
 procedure _lcd_write_command(byte in value) is ;
---   pragma inline
+   pragma inline
    lcd_rs = low                             -- select instruction
-   __lcd_write( value )                      -- output byte
+   _lcd_write( value )                      -- output byte

    if value < 4 then                                        -- "clear display' 
and 'return home'
       delay_10us( lcd_long_delay )                       -- require extra delay
@@ -135,34 +134,55 @@
 -- moves to the right.
-- ----------------------------------------------------------------------------
 procedure lcd_init() is
---   pragma inline
+    pragma inline
     delay_1ms( 45 )                            -- powerup delay for 45mS
-    if LCD_ROWS == 1 then
-       _lcd_write_command( 0b_0011_0000 )              -- function 8bit 
N=0,5x7dots
- _lcd_write_command( 0b_0011_0001 ) -- function 8bit N=0,5x7dots IS1=1
-       _lcd_write_command( 0b_0001_0100 )              -- BIAS  1 and 2 line 
setting
-    end if
-    if LCD_ROWS == 2 then
-       _lcd_write_command( 0b_0011_1000 )              -- function 8bit 
N=1,5x7dots
- _lcd_write_command( 0b_0011_1001 ) -- function 8bit N=1,5x7dots IS1=1
-       _lcd_write_command( 0b_0001_0100 )              -- BIAS  1 and 2 line 
setting
-    end if
-    if LCD_ROWS == 3 then
-       _lcd_write_command( 0b_0011_1000 )              -- function 8bit 
N=1,5x7dots
- _lcd_write_command( 0b_0011_1001 ) -- function 8bit N=1,5x7dots IS1=1
-       _lcd_write_command( 0b_0001_0101 )              -- BIAS  3 line setting
-    end if
-
-
-    _lcd_write_command( 0b_0111_0000 )                 -- contrast set
-    _lcd_write_command( 0b_0101_1110 )                 -- power/ICON/contrast 
control
-    _lcd_write_command( 0b_0110_1010 )                 -- follower control
- delay_1ms( 210 ) -- extra delay to let display settle
-
-    -- init the API
-    _hd44780_init()
-
-end procedure
+
+       if LCD_ROWS == 1 then
+          _lcd_write_Command( 0b_0011_0000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_0001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0100 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+
+       end if
+
+       if LCD_ROWS == 2 then
+          _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_1001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0100 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+
+       end if
+
+       if LCD_ROWS == 3 then
+          _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_1001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0101 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+       end if
+
+       _lcd_write_Command( 0b_0111_0000 ) -- contrast set
+       delay_10uS( 3)                    -- extra delay
+       _lcd_write_Command( 0b_0101_1110 ) -- power/ICON/contrast control
+       delay_10uS( 3 )
+       _lcd_write_Command( 0b_0110_1010 ) -- follower control
+ delay_1mS( 210 ) -- extra delay to let display settle
+       _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+       delay_10uS ( 3 )                      -- extra delay
+       _lcd_write_Command( 0b_0000_1100 )-- display on/off control
+          delay_10us( 3 )
+       _lcd_write_Command( 0b_0000_0001 )-- clear display
+          delay_10us( 40 )
+ _lcd_write_Command( 0b_0000_0110 )-- entry mode set, cursor moves to right
+          delay_10us( 40 )
+
+ end procedure
+-- ----------------------------------------------------------------------------



=======================================
--- /trunk/include/external/lcd/lcd_dog_m_spi.jal       Mon Mar 16 02:14:57 2009
+++ /trunk/include/external/lcd/lcd_dog_m_spi.jal       Tue Feb  2 12:38:49 2010
@@ -47,22 +47,22 @@
 --          pin_b1_direction    = output
 --    4. Call lcd_init() to initialize the lcd controller.
 --    Above is an example for a 2x16 LCD:
---
+-- --
 --    Available functions for application programs:
---
---
---      __lcd_write(<byte>)                     ends byte from value to
+-- --
+-- --
+--      _lcd_write(<byte>)                     ends byte from value to
 --                                             register of the lcd  and
-- shift cursor position 1 right
---
+-- --
 --      _lcd_write_data(<byte>)                write data to lcd using
--- __lcd_write(<byte>) lcd_rs high
---
+-- _lcd_write(<byte>) lcd_rs high
+-- --
 --      _lcd_write_data(<byte>)                write command to lcd using
--- __lcd_write(<byte>) lcd_rs low
---
+-- _lcd_write(<byte>) lcd_rs low
+-- --
-- lcd_init() initialize the LCD controller
---
+-- --
 --
 -- Dependencies: delay.jal
 --
@@ -92,8 +92,8 @@
 -- sends byte from value to register of the lcd
 -- (this procedure is only used inside this file)
-- ----------------------------------------------------------------------------
-procedure  __lcd_write(byte in value) is
---   pragma inline
+procedure  _lcd_write(byte in value) is
+   pragma inline
    lcd_csb = low                               -- select lcd (wake him up)
for 8 loop -- loop for sending serial information
           var bit bit7 at value : 7
@@ -111,24 +111,24 @@

-- ----------------------------------------------------------------------------
 -- sends data byte in value to LCD
---
+-- for slow commands an extra delay should be added --
-- ----------------------------------------------------------------------------
 procedure _lcd_write_data(byte in value) is
---  pragma inline
-  lcd_rs = high                                                        -- 
select data
-  __lcd_write( value )                                 -- output byte
+    lcd_rs = high                                                      -- 
select instruction
+    _lcd_write( value )                                -- output byte
 end procedure
 ---------------------------------------------------------------------------


-- ----------------------------------------------------------------------------
 -- sends command byte in value to LCD
---
+-- for slow commands an extra delay should be added
+--
-- ----------------------------------------------------------------------------
 procedure _lcd_write_command(byte in value) is ;
---   pragma inline
+   pragma inline
    lcd_rs = low                             -- select instruction
-   __lcd_write( value )                      -- output byte
+   _lcd_write( value )                      -- output byte

    if value < 4 then                                        -- "clear display' 
and 'return home'
       delay_10us( lcd_long_delay )                     -- require extra delay
@@ -148,25 +148,52 @@
 -- moves to the right.
-- ----------------------------------------------------------------------------
 procedure lcd_init() is
---   pragma inline
+    pragma inline
     delay_1ms( 45 )                            -- powerup delay for 45mS
-    _lcd_write_command( 0b_0011_0000 )                 -- function 8bit 
N=1,5x7dots
-    _lcd_write_command( 0b_0011_0001 )                 -- function 8bit 
N=1,5x7dots IS1=1
-    if LCD_ROWS == 3 then
-        _lcd_write_command( 0b_0001_0101 )             -- BIAS  3 line setting
-    else
-        _lcd_write_command( 0b_0001_0100 )             -- BIAS  1 and 2 line 
setting
-    end if
-
-    _lcd_write_command( 0b_0111_0000 )                 -- contrast set
-    _lcd_write_command( 0b_0101_1110 )                 -- power/ICON/contrast 
control
-    _lcd_write_command( 0b_0110_1010 )                 -- follower control
- delay_1ms( 210 ) -- extra delay to let display settle
-
-    -- init the API
-    _hd44780_init()
-
-end procedure
-
-
-
+
+       if LCD_ROWS == 1 then
+          _lcd_write_Command( 0b_0011_0000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_0001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0100 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+
+       end if
+
+       if LCD_ROWS == 2 then
+          _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_1001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0100 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+
+       end if
+
+       if LCD_ROWS == 3 then
+          _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+          delay_10uS ( 3 )                       -- extra delay
+          _lcd_write_Command( 0b_0011_1001 ) -- function set lcd port
+          delay_10uS ( 3 )                      -- extra delay
+          _lcd_write_Command( 0b_0001_0101 ) -- BIAS
+          delay_10uS ( 3 )                      -- extra delay
+       end if
+
+       _lcd_write_Command( 0b_0111_0000 ) -- contrast set
+       delay_10uS( 3)                    -- extra delay
+       _lcd_write_Command( 0b_0101_1110 ) -- power/ICON/contrast control
+       delay_10uS( 3 )
+       _lcd_write_Command( 0b_0110_1010 ) -- follower control
+ delay_1mS( 210 ) -- extra delay to let display settle
+       _lcd_write_Command( 0b_0011_1000 ) -- function set lcd port
+       delay_10uS ( 3 )                      -- extra delay
+       _lcd_write_Command( 0b_0000_1100 )-- display on/off control
+          delay_10us( 3 )
+       _lcd_write_Command( 0b_0000_0001 )-- clear display
+          delay_10us( 40 )
+ _lcd_write_Command( 0b_0000_0110 )-- entry mode set, cursor moves to right
+          delay_10us( 40 )
+end procedure
+-- ----------------------------------------------------------------------------
+
=======================================
--- /trunk/include/external/lcd/lcd_hd44780_4.jal       Mon Jan 25 03:11:14 2010
+++ /trunk/include/external/lcd/lcd_hd44780_4.jal       Tue Feb  2 12:38:49 2010
@@ -1,7 +1,7 @@
-- ----------------------------------------------------------------------------- -- Title: LCD library for HD44780 compatible LCDs, with 4 bits wide datatransfer
 -- Author: Rob Hamerling, Copyright (c) 2008..2009, all rights reserved.
--- Adapted-by: Eur van Andel, Joep Suijs (refactoring)
+-- Adapted-by: Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init)
 -- Compiler:  >=2.4g
 --
 -- This file is part of jallib (http://jallib.googlecode.com)
@@ -146,10 +146,12 @@
    delay_10us(4)                                -- > 37 us
    __lcd_write_nibble(0b0000_0010)              -- to 4-bit mode
    delay_10us(4)                                -- > 37 us
-
-    -- init the API
-    _hd44780_init()
-
+   _lcd_write_command(0b_0010_1000)             -- 2 lines, 5x7 pattern
+   _lcd_write_command(0b_0001_1100)             -- cursor move right
+ _lcd_write_command(0b_0000_1100) -- display on, cursor,blink off
+   _lcd_write_command(0b_0000_0110)             -- cursor->right, no shift
+   lcd_clear_screen()                           -- clear screen
+ -- (incl switch to data char mode)
 end procedure


=======================================
--- /trunk/include/external/lcd/lcd_hd44780_8.jal       Sat Apr  4 02:40:31 2009
+++ /trunk/include/external/lcd/lcd_hd44780_8.jal       Tue Feb  2 12:38:49 2010
@@ -1,7 +1,7 @@
-- ----------------------------------------------------------------------------- -- Title: LCD library for HD44780 compatible LCDs, with 8 bits wide datatransfer
 -- Author: Rob Hamerling, Copyright (c) 2008..2009, all rights reserved.
--- Adapted-by: Eur van Andel, Joep Suijs (refactoring)
+-- Adapted-by: Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init)
 -- Compiler:  >=2.4g
 --
 -- This file is part of jallib (http://jallib.googlecode.com)
@@ -156,9 +156,12 @@
    delay_10us(4)                                -- > 37 us
    _lcd_write_command(0b0011_1000)              -- to 8-bit mode
    delay_10us(4)                                -- > 37 us
-
-    -- init the API
-    _hd44780_init()
+   _lcd_write_command(0b_0010_1000)             -- 2 lines, 5x7 pattern
+   _lcd_write_command(0b_0001_1100)             -- cursor move right
+ _lcd_write_command(0b_0000_1100) -- display on, cursor,blink off
+   _lcd_write_command(0b_0000_0110)             -- cursor->right, no shift
+   lcd_clear_screen()                           -- clear screen
+ -- (incl switch to data char mode)

 end procedure

=======================================
--- /trunk/include/external/lcd/lcd_hd44780_common.jal Mon Dec 14 07:39:04 2009 +++ /trunk/include/external/lcd/lcd_hd44780_common.jal Tue Feb 2 12:38:49 2010
@@ -14,61 +14,6 @@
 -- .
 --  Procedures which can be used by application program:
 -- .
--- * lcd_write_char( byte in value ):
---   writes 'value' to lcd
---   example: lcd_write_char( "E" )  or lcd_write_char( 69 )
--- .
--- * lcd = value:
---   writes 'value' to lcd
---   example: lcd = "E"  or lcd = 69
--- .
--- * lcd_cursor_position(byte in line, byte in pos):
---   places the cursor on position (pos) in line (line) (zero based!)
---   example: lcd_new_line_cursor_position (1, 8)
--- .
--- * lcd_shift_left(byte in value):
--- shifts the display [value] times to the left without changing DDRAM data.
---   example: lcd_shift_left(4)
---   or       lcd_shift_left(variable)
--- .
--- * lcd_shift_right(byte in value):
--- shifts the display [value] times to the right without changing DDRAM data.
---   example: lcd_shift_right(12)
---   or       lcd_shift_right(variable)
--- .
--- * lcd_cursor_shift_left(byte in value):
---   shifts the cursor [value] times to the left without changing display
---   contents and DDRAM data.
---   example: lcd_cursor_shift_left(8)
---   or       lcd_cursor_shift_left(variable)
--- .
--- * lcd_cursor_shift_right(byte in value):
---   shifts the cursor [value] times to the right without changing display
---   contents and DDRAM data.
---   example: lcd_cursor_shift_right(3)
---   or       lcd_cursor_shift_right(variable)
--- .
--- * lcd_clear:
---   Write "20H" to DDRAM and set DDRAM address to "00H" from AC
---   This will clear the display.
--- .
--- * lcd_home:
---   Set DDRAM address to "00H" from AC and return cursor to its original
---   position if shifted. The contents of DDRAM are not changed.
--- .
--- * lcd_cursor_blink_display(bit in cursor,bit in blink,bit in display):
---   sets the underline cursor on/off, let the block-cursor blinking/off
---   and puts the display on/off
---   example: lcd_cursor_blink_display(on,off,on)
--- .
--- * lcd_clear_line ( byte in line  )
---   clears the line [line] of the lcd including DDRAM data of that line
---   example: lcd_clear_line(1)
--- .
--- * lcd_progress(byte in line, byte in amount)
---   create a progress bar on line [line] with a lenght of [amout]
---   example: lcd_progress(2,12)
---
 --
 -- Sources:
 --
@@ -296,25 +241,6 @@
 end procedure


--- ---------------------------------------------------------------------------- --- _hd44780_init - Initialise display (not realy internal, but not for users)
---
--- This procedure is called from lcd_init of the interface used. lcd_init brings
--- up the interface and powers up the display.
--- This procedure sets the display in the pre-defined startposition (clear
--- screen, no cursor etc).
--- ----------------------------------------------------------------------------
-procedure _hd44780_init() is
-
-   _lcd_write_command(0b_0010_1000)             -- 2 lines, 5x7 pattern
-   _lcd_write_command(0b_0001_1100)             -- cursor move right
- _lcd_write_command(0b_0000_1100) -- display on, cursor,blink off
-   _lcd_write_command(0b_0000_0110)             -- cursor->right, no shift
-   lcd_clear_screen()                           -- clear screen
- -- (incl switch to data char mode)
-end procedure
-
-
-- ----------------------------------------------------------------------------
 -- Deprecated
 procedure lcd_clearscreen()  is
=======================================
--- /trunk/include/external/lcd/lcd_hd44780_serial_sw.jal Tue Mar 31 01:03:45 2009 +++ /trunk/include/external/lcd/lcd_hd44780_serial_sw.jal Tue Feb 2 12:38:49 2010
@@ -1,7 +1,7 @@
-- ----------------------------------------------------------------------------- -- Title: LCD library for HD44780 compatible LCDs, interfaced with 1 pin (serial_sw)
 -- Author: Joep Suijs, Copyright (c) 2008..2009, all rights reserved.
--- Adapted-by:
+-- Adapted-by:Richard Zengerink (lcd_init)
 -- Compiler:  >=2.4g
 --
 -- This file is part of jallib (http://jallib.googlecode.com)
@@ -121,9 +121,13 @@
    delay_10us(4)                                -- > 37 us
    __lcd_write_nibble(0b0000_0010)              -- to 4-bit mode
    delay_10us(4)                                -- > 37 us
-
-    -- init the API
-    _hd44780_init()
+   _lcd_write_command(0b_0010_1000)             -- 2 lines, 5x7 pattern
+   _lcd_write_command(0b_0001_1100)             -- cursor move right
+ _lcd_write_command(0b_0000_1100) -- display on, cursor,blink off
+   _lcd_write_command(0b_0000_0110)             -- cursor->right, no shift
+   lcd_clear_screen()                           -- clear screen
+ -- (incl switch to data char mode)
+
 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