Author: jsuijs
Date: Sun Mar  8 06:31:03 2009
New Revision: 841

Modified:
    trunk/include/external/lcd/lcd_hd44780_common.jal
    trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal

Log:
lcd/lcd_hd44780_common.jal refactoring is done (i think).

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   Sun Mar  8 06:31:03  
2009
@@ -11,19 +11,10 @@
  -- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
  --
  -- Description: Common API for HD44780 based LCD
---
--- Sources:
---
--- Notes:
---
---
--- ------------------------------------------------------
---
---
  --  
-------------------------------------------------------------------------
---  procedures which can be used in your Main file
+--  procedures which can be used in your Main file:
  --  
-------------------------------------------------------------------------
---
+--        ---------------
  -- * lcd_write_char( byte in value ):
  --   writes 'value' to lcd
  --   example: lcd_write_char( "E" )  or lcd_write_char( 69 )
@@ -40,46 +31,49 @@
  --   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 cursor on/off, let the cursor blink or not(if the cursor is  
on),
+--   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:
  --
+-- Notes:
  --

  --  
----------------------------------------------------------------------------
@@ -230,8 +224,8 @@
  -- lcd_cursor_blink_display - (re)sets cursor blink and puts display on/off
  --  
----------------------------------------------------------------------------
  -- params:
---    cursor:  enable or disable the cursor
---    blink:   enable or disable blinking of the cursor
+--    cursor:  enable or disable the fixed underline cursor
+--    blink:   enable or disable blinking of the block-cursor (so block  
blinking or off)
  --    display: enable or disable the whole display
  --  
----------------------------------------------------------------------------
  procedure lcd_cursor_blink_display(bit in cursor, bit in blink, bit in  
display) is

Modified: trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal
==============================================================================
--- trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal       
(original)
+++ trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal      Sun Mar 
  
8 06:31:03 2009
@@ -35,7 +35,6 @@
  --  
----------------------------------------------------------------------------
  include serial_tc_header

-
  -- setup libs, io etc
  lcd_rs_direction        = output
  lcd_en_direction        = output
@@ -46,34 +45,13 @@
  include delay
  lcd_init()                              -- initialize LCD

+var byte value = 0

+lcd_clear_screen()
+lcd_home()

-   var byte data
-   var word wvalue = 0
-   var byte value = 0
-   var byte value1 = 0
-   var byte test = 0
-   var byte hrs = 12
-   var byte min = 55
-   var byte sec = 40
-   var byte year = 09
-   var word yearw = 2009
-   var byte month = 03
-   var byte day = 23
-
-   const byte teststring[] = "test display"
-
-   lcd_cursor_position (1, 1)
-   lcd_clear_screen()
-   lcd_home()
-
-
-   lcd = "T"
-   lcd = "e"
-   lcd = "s"
-   lcd = "t"
-;   delay_100ms (10)
-
+const byte teststring[] = "Serial TC ready."
+print_string(lcd, teststring)

  --  
-----------------------------------------------------------------------------
  -- Define all unit tests required
@@ -90,8 +68,6 @@
  end procedure
  -- test support function end

-
-
  const byte testname_a[] = "clear screen"
  procedure unit_test_a() is
     lcd_clear_screen()
@@ -102,51 +78,102 @@
     lcd_home()
  end procedure

-const byte testname_c[] = "set cursor position to 0,0 (start line 0)"
+const byte testname_c[] = "print 4 incremening chars to cursor pos with  
lcd_write_char"
  procedure unit_test_c() is
-   lcd_cursor_position(0,0)
+   for 4 loop
+      lcd_write_char(testchar)
+      increment_testchar()
+   end loop
  end procedure

-const byte testname_d[] = "set cursor position to 1,0 (start line 1)"
+const byte testname_d[] = "print 4 incremening chars to cursor pos with  
lcd'put"
  procedure unit_test_d() is
-   lcd_cursor_position(1,0)
+   for 4 loop
+      lcd = testchar
+      increment_testchar()
+   end loop
  end procedure

-const byte testname_e[] = "set cursor position to 2,0 (start line 2)"
+const byte testname_e[] = "set cursor position to 0,0 (start line 0)"
  procedure unit_test_e() is
-   lcd_cursor_position(2,0)
+   lcd_cursor_position(0,0)
  end procedure

-const byte testname_f[] = "set cursor position to 3,0 (start line 3)"
+const byte testname_f[] = "set cursor position to 1,0 (start line 1)"
  procedure unit_test_f() is
-   lcd_cursor_position(3,0)
+   lcd_cursor_position(1,0)
  end procedure

-const byte testname_g[] = "set cursor position to tc_var0, tc_var1"
+const byte testname_g[] = "set cursor position to 2,0 (start line 2)"
  procedure unit_test_g() is
-   lcd_cursor_position(tc_var0, tc_var1)
+   lcd_cursor_position(2,0)
  end procedure

-const byte testname_h[] = "print 4 incremening chars to cursor pos with  
lcd_write_char"
+const byte testname_h[] = "set cursor position to 3,0 (start line 3)"
  procedure unit_test_h() is
-   for 4 loop
-      lcd_write_char(testchar)
-      increment_testchar()
-   end loop
+   lcd_cursor_position(3,0)
  end procedure

-const byte testname_i[] = "print 4 incremening chars to cursor pos with  
lcd'put"
+const byte testname_i[] = "set cursor position to tc_var0, tc_var1"
  procedure unit_test_i() is
-   for 4 loop
-      lcd = testchar
-      increment_testchar()
-   end loop
+   lcd_cursor_position(tc_var0, tc_var1)
+end procedure
+
+const byte testname_j[] = "clear line tc_var0"
+procedure unit_test_j() is
+   lcd_clear_line(tc_var0)
+end procedure
+
+const byte testname_k[] = "display off"
+procedure unit_test_k() is
+   lcd_cursor_blink_display(false, false, false)
+end procedure
+
+const byte testname_l[] = "display on - no cursor"
+procedure unit_test_l() is
+   lcd_cursor_blink_display(false, false, on)
+end procedure
+
+const byte testname_m[] = "display on - blinking block cursor"
+procedure unit_test_m() is
+   lcd_cursor_blink_display(false, true, on)
+end procedure
+
+const byte testname_n[] = "display on - fixed underline cursor"
+procedure unit_test_n() is
+   lcd_cursor_blink_display(true, false, on)
  end procedure

+const byte testname_o[] = "display on - cursor blinks from underline to  
block"
+procedure unit_test_o() is
+   lcd_cursor_blink_display(true, true, on)
+end procedure
+
+const byte testname_p[] = "lcd shift left tc_var2 chars"
+procedure unit_test_p() is
+   lcd_shift_left(tc_var2)
+end procedure
+
+const byte testname_q[] = "lcd shift right tc_var2 chars"
+procedure unit_test_q() is
+   lcd_shift_right(tc_var2)
+end procedure
+
+const byte testname_r[] = "lcd CURSOR shift left tc_var2 chars"
+procedure unit_test_r() is
+   lcd_cursor_shift_left(tc_var2)
+end procedure
+
+const byte testname_s[] = "lcd CURSOR shift right tc_var2 chars"
+procedure unit_test_s() is
+   lcd_cursor_shift_right(tc_var2)
+end procedure
+
+
  -- this test shows a incrementing counter on the first line
  -- and a progress bar on the second line.
-const byte testname_p[] = "progress bar"
-procedure unit_test_p() is
+const byte testname_z[] = "progress bar"
+procedure unit_test_z() is
     const byte bar_divider = (255 / (LCD_CHARS-1))

     const byte tc_p[] = "progress      "
@@ -168,159 +195,16 @@
     end loop
  end procedure

-
-const byte testname_z[] = "shift test"
-procedure unit_test_z() is
-
-      lcd_cursor_position (2, 1)
-      print_string(lcd, teststring)
-
-      delay_100ms (10)
-      lcd_shift_right (6)
-      delay_100ms (10)
-      lcd_shift_left (4)
-      delay_100ms (10)
-
-end procedure
-
-const byte testname_y[] = "blink on test"
-procedure unit_test_y() is
-
-      lcd_cursor_position (2, 1)
-
-
-      lcd_cursor_position (2, 1)
-      print_string(lcd, teststring)
-      lcd_cursor_blink_display (on,on,on)
-      delay_100ms (10)
-      lcd_cursor_shift_left (4)
-      delay_100ms (10)
-      lcd_cursor_shift_right (6)
-      delay_100ms (10)
-      lcd_clear_line  ( 2 )
-      delay_100ms (10)
-      lcd_home()
-      delay_100ms (10)
-      lcd_clear_screen()
-
-end procedure
-
-
-const byte testname_x[] = "blink off test"
-procedure unit_test_x() is
-
-      lcd_cursor_blink_display (off,off,on)
-      lcd_clear_line  (2)
-      value = 0
-      while value < 255  loop
-;         lcd_bvalue_dp_line_pos_left_sign ( value, 0, 1, 5, true, false)
-         value = value + 1
-         delay_1ms(50)
-         lcd_progress  (2, (value/17)+1, 0xFF)
-      end loop
-;      lcd_bvalue_dp_line_pos_left_sign ( value, 0, 1, 5, true, false)
-      delay_100ms (20)
-      lcd_clear_screen()
-end procedure
-
-const byte testname_w[] = "blink off test"
-procedure unit_test_w() is
-
-;      lcd_bvalue_dp_line_pos_left_sign ( 200, 0, 1, 1, true, false)
-;      delay_100ms (10)
-;      lcd_bvalue_dp_line_pos_left_sign ( 5, 0, 1, 5, true, false)
-;      delay_100ms (10)
-;      lcd_bvalue_dp_line_pos_left_sign ( 7, 0, 1, 9, false, false)
-;      delay_100ms (10)
-;      lcd_bvalue_dp_line_pos_left_sign ( 112, 1, 1, 13, false, false)
-;      delay_100ms (10)
-
-      lcd_clear_line  (2)
-
-      lcd_write_char("V")
-      lcd_write_char("a")
-      lcd_write_char("l")
-
-      lcd_cursor_position (2, 5)  ;
-
-      lcd_write_char ("=")
-
-
-      lcd_clear_line  (1)
-
-      value1 = 0
-      wvalue = 5000
-
-;      while wvalue != 0  loop
-;         lcd_wvalue_dp_line_pos_left_sign ( wvalue, 2, 2, 7, true, false)
-;         wvalue = wvalue - 1
-;         delay_1ms(3)
-;       end loop
-;         lcd_wvalue_dp_line_pos_left_sign ( wvalue, 2, 2, 7, true, false)
-;      delay_100ms (20)
-
-;      lcd_clearscreen()
-;      lcd_cursor_position (1, 5)
-;      lcd_date ( day, month, year, "-", true )
-;
-;      sec = 40
-;
-;      while sec< 60 loop
-;         lcd_cursor_position (2, 5)
-;         lcd_time ( hrs, min, sec, ":" )
-;         sec = sec + 1
-;         delay_100ms (10)
-;      end loop
-;      lcd_cursor_position (1, 5)
-;      lcd_date ( day, month, yearw, "/", false )
-;      delay_100ms (30)
-end procedure
-
-const byte testname_v[] = "hex run test"
-procedure unit_test_v() is
-
-      lcd_clear_screen()
-
-      value1 = 0
-      lcd_cursor_position (1, 5)
-      lcd = "="
-      while value1 < 255  loop
-;         lcd_bvalue_dp_line_pos_left_sign ( value1, 0, 1, 1, false, false)
-         lcd_cursor_position (1, 7)
-         print_prefix = true;
-         print_byte_hex(lcd, value1);
-
-         value1 = value1 + 1
-         delay_1ms(250)
-      end loop
-
-      wvalue = 0
-      lcd_cursor_position (2, 7)
-      lcd = "="
-
-
-;      while wvalue < 2000  loop
-;         lcd_wvalue_dp_line_pos_left_sign ( wvalue, 0, 2, 1, false, false)
-;         lcd_cursor_position (2, 9)
-;         print_prefix = true;
-;         print_byte_hex(lcd, wvalue);
-;
-;         wvalue = wvalue + 1
-;         delay_1ms(5)
-;      end loop
-
-      lcd_clear_screen()
-
-end procedure
-
-
  --  
-----------------------------------------------------------------------------
  --  
-----------------------------------------------------------------------------
  -- include testconsole after definition of unit tests
  --  
-----------------------------------------------------------------------------
  --  
-----------------------------------------------------------------------------
  include serial_testconsole
-testconsole_init()
+testconsole_init()
+
+tc_var2 = 1 -- default (used for left/right shift)
+
  testconsole()  -- contains forever loop



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