Author: jsuijs
Date: Sun Mar 1 07:24:29 2009
New Revision: 819
Modified:
trunk/include/external/lcd/js_replace.jal
trunk/include/external/lcd/lcd_hd44780_common.jal
trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal
trunk/sample/test/external/lcd/test_lcd_hd44780_4.jal
Log:
lcd interface looks okay now, and all 0-based. TODO: backlight, testing &
comment update.
Modified: trunk/include/external/lcd/js_replace.jal
==============================================================================
--- trunk/include/external/lcd/js_replace.jal (original)
+++ trunk/include/external/lcd/js_replace.jal Sun Mar 1 07:24:29 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: LCD refactoring
+-- Description: LCD refactoring - this procedures are to be deprecated or
removed
--
-- Sources:
--
@@ -18,64 +18,9 @@
--
--
-- ------------------------------------------------------
-
-var byte lcd_maxdigit
+byte lcd_maxdigit
var byte lcd_nodigit
-;--
-----------------------------------------------------------------------------
-;-- Displays a byte value in Hex,
-;--
-----------------------------------------------------------------------------
-;procedure lcd_bvalue_hex( byte in value) is
-; pragma inline
-;
-; print_prefix = true;
-; print_byte_hex(lcd, value);
-;
-;end procedure
-;
-;--
----------------------------------------------------------------------------
-;
-;
-;--
-----------------------------------------------------------------------------
-;-- Displays a word value in Hex,
-;--
-----------------------------------------------------------------------------
-;procedure lcd_wvalue_hex( word in value) is
-; pragma inline
-;
-; print_prefix = true;
-; print_word_binary(lcd, value);
-;
-;end procedure
-;
-;--
----------------------------------------------------------------------------
-;
-;--
-----------------------------------------------------------------------------
-;-- Displays a byte value in binairy,
-;--
-----------------------------------------------------------------------------
-;procedure lcd_bvalue_bin( byte in value) is
-; pragma inline
-;
-; print_prefix = true;
-; print_byte_binary(lcd, value);
-;
-;end procedure
-;
-;--
----------------------------------------------------------------------------
-;
-;--
-----------------------------------------------------------------------------
-;-- Displays a string
-;--
-----------------------------------------------------------------------------
-;procedure lcd_string( byte in string[]) is
-; pragma inline
-;
-; print_string(lcd, string)
-;
-;end procedure
-
-
---
----------------------------------------------------------------------------
-
-
--
-----------------------------------------------------------------------------
-- Displays a value (byte), whith or without Decimal Point, on specified
line
-- and position , non leading zero ,with or without left alignment, signed
@@ -179,6 +124,27 @@
end procedure
--
----------------------------------------------------------------------------
+
+
+--
+-- * lcd_bvalue_dp_line_pos_left_sign( byte in value, byte in dp, byte in
line, byte in poskar, bit in left, bit in sign )
+-- displays a byte value with decimal point on position [dp] on line
[line] on position [pos] left alignment true/false,
+-- signed value true/false
+-- byte value = 0 to 255 as value or as variable, dp = 0 means 100 dp =
1 means 10.0 dp = 2 means 1.00 and dp > than 3 means 0.100
+--
+--
+-- example1: lcd_bvalue_dp_line_pos_left_sign(25,0,1,5,true,false)
+-- result on line 1 on position 5 you get 25
+--
+-- example2: lcd_bvalue_dp_line_pos_left_sign(25,0,1,5,false,false)
+-- result on line 1 on position 5 you get [space]25 (25 starts at
position 6)
+--
+-- example3: lcd_bvalue_dp_line_pos_left_sign(225,0,2,1,true,true)
+-- result on line 2 on position 1 you get -31
+--
+-- example4: lcd_bvalue_dp_line_pos_left_sign(225,0,2,1,true,false)
+-- result on line 2 on position 1 you get 225
+--
--
-----------------------------------------------------------------------------
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 1 07:24:29
2009
@@ -1,4 +1,4 @@
--- ------------------------------------------------------
+--
-------------------------------------------------------------------------
-- Title: common for HD44780 based LCD
--
-- Author: Richard Zengerink, Copyright (c) 2008..2009, all rights
reserved.
@@ -24,9 +24,13 @@
-- procedures which can be used in your Main file
--
-------------------------------------------------------------------------
--
--- * lcd_write_data( byte in value ):
--- writes(byte) data to lcd
--- example: lcd_write_data( "E" ) or lcd_write_data( 69 )
+-- * 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_new_line_cursor_position(byte in line, byte in pos):
-- places the cursor on position (pos) in line (line)
@@ -78,198 +82,159 @@
-- example: lcd_progress(2,12)
--
--
--- * lcd_bvalue_dp_line_pos_left_sign( byte in value, byte in dp, byte in
line, byte in poskar, bit in left, bit in sign )
--- displays a byte value with decimal point on position [dp] on line
[line] on position [pos] left alignment true/false,
--- signed value true/false
--- byte value = 0 to 255 as value or as variable, dp = 0 means 100 dp =
1 means 10.0 dp = 2 means 1.00 and dp > than 3 means 0.100
---
---
--- example1: lcd_bvalue_dp_line_pos_left_sign(25,0,1,5,true,false)
--- result on line 1 on position 5 you get 25
---
--- example2: lcd_bvalue_dp_line_pos_left_sign(25,0,1,5,false,false)
--- result on line 1 on position 5 you get [space]25 (25 starts at
position 6)
---
--- example3: lcd_bvalue_dp_line_pos_left_sign(225,0,2,1,true,true)
--- result on line 2 on position 1 you get -31
---
--- example4: lcd_bvalue_dp_line_pos_left_sign(225,0,2,1,true,false)
--- result on line 2 on position 1 you get 225
---
---
--- * lcd_wvalue_dp_line_pos_left_sign( word in value, byte in dp, byte in
line, byte in poskar, bit in left, bit in sign )
---
---
---
--- * lcd_time( byte in hrs, byte in minut, byte in second, byte in
seperator )
---
---
---
--- * lcd_date( byte in day, byte in mounth, word in year, byte in
seperator, bit in day_mounth_notation )
---
---
--- * lcd_bvalue_hex( byte in value)
---
---
--- * lcd_wvalue_hex( word in value)
---
---
---
--- * lcd_bvalue_bin( byte in value)
---
---
---
--
---
-----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
-- some constants to control the lcd
---
-----------------------------------------------------------------------------
-const lcd_clear_display = 0b_0000_0001
-const lcd_return_home = 0b_0000_0010
-const lcd_display_onoff = 0b_0000_1000
-const lcd_cursor_shift_r_val = 0b_0001_0100
-const lcd_cursor_shift_l_val = 0b_0001_0000
-const lcd_display_shift_right = 0b_0001_1100
-const lcd_display_shift_left = 0b_0001_1000
+--
----------------------------------------------------------------------------
+const LCD_CLEAR_DISPLAY = 0b_0000_0001
+const LCD_RETURN_HOME = 0b_0000_0010
+const LCD_DISPLAY_ONOFF = 0b_0000_1000
+const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100
+const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000
+const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100
+const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000
-const lcd_set_ddram_address = 0b_1000_0000
---
-----------------------------------------------------------------------------
+const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000
+--
----------------------------------------------------------------------------
var volatile byte lcd_pos = 0
+--
----------------------------------------------------------------------------
+-- _lcd_line2index - internal function - calculate index from line number
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+function _lcd_line2index (byte in line) return byte is
--- to be depricated
-procedure lcd_writechar(byte in data) is
-; pragma inline
- _lcd_write_data(data)
-end procedure
-
-
-procedure lcd_write_char(byte in data) is
-; pragma inline
- _lcd_write_data(data)
-end procedure
-
-procedure lcd'put(byte in data) is
- pragma inline
- _lcd_write_data(data)
-end procedure
+ -- force valid line number
+ if (line >= LCD_ROWS) then line = 0 end if
+ case line of
+ 0: return 0x00
+ 1: return 0x40
+ 2: return 0x14
+ 3: return 0x54
+ end case
+
+end function
+--
----------------------------------------------------------------------------
--
----------------------------------------------------------------------------
--- sets the cursor of the LCD to the position in the shadow register
+-- _lcd_restore_cursor - sets the cursor to the position in the shadow
register
+--
----------------------------------------------------------------------------
-- (this routine is only used inside this file)
--
----------------------------------------------------------------------------
procedure _lcd_restore_cursor() is
- -- set LCD back to normal operation
- _lcd_write_command( lcd_set_ddram_address | lcd_pos )
+ -- set LCD back to normal operation
+ _lcd_write_command( lcd_set_ddram_address | lcd_pos )
end procedure
--
----------------------------------------------------------------------------
-
--
----------------------------------------------------------------------------
--- sets the cursor of the LCD on "pos" position in line "line" in the
shadow register
---
+-- lcd_write_char - write one char to LCD
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+procedure lcd_write_char(byte in data) is
+ _lcd_write_data(data)
+end procedure
--
----------------------------------------------------------------------------
-procedure lcd_new_line_cursor_position(byte in line, byte in pos) is
- pos = pos -1
- if LCD_ROWS == 1 then
- lcd_pos = pos
-
- elsif LCD_ROWS == 2 then
- if line == 1 then
- lcd_pos = pos
- else
- lcd_pos = pos + 0x40
- end if
- else -- 4 lines
- if line == 1 then lcd_pos = pos
- elsif line == 2 then lcd_pos = pos + 0x40
- elsif line == 3 then lcd_pos = pos + 0x14
- else line == 4 then lcd_pos = pos + 0x54
- end if
- end if
- _lcd_restore_cursor()
+--
----------------------------------------------------------------------------
+-- lcd'put - write one char to screen (pseudo var, enables streams)
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+procedure lcd'put(byte in data) is
+ pragma inline
+ _lcd_write_data(data)
+end procedure
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+-- lcd_set_cursor - Specify row and column (0-based)
+--
----------------------------------------------------------------------------
+-- About cursor positions: the LCDs are internally 2x40 char devices.
+-- The first line starts at offset 0, the second line at offset 64 (0x40).
+-- With 4 line devices the third and fourth line are addressed as
extensions
+-- of the first and second line by adding an offset. For a 4x20 line device
+-- the offset is 20, for a 4x16 line display the offset is 16 or 20.
+-- Declare the constant LCD_CHARS as appropriate for your screen
+-- (you may have to specify 20 even if your display has only 16 chars!).
+--
+-- Note: Some 1x16 LCDs are implemented as 2x8 line LCDs, which means that
+-- the second half of the line has to be handled as a second line.
+--
----------------------------------------------------------------------------
+procedure lcd_cursor_position(byte in line, byte in pos) is
+ lcd_pos = pos + _lcd_line2index(line)
+ _lcd_restore_cursor()
end procedure
-
-
+--
----------------------------------------------------------------------------
--
----------------------------------------------------------------------------
--- shifts the coplete display one position to the left
+-- lcd_shift_left - shifts the complete display one position to the left
--
----------------------------------------------------------------------------
procedure lcd_shift_left(byte in nr) is
- -- set LCD back to normal operation
-
- if nr != 0 then
+ -- set LCD back to normal operation
+ if nr != 0 then
for nr loop
- _lcd_write_command( lcd_display_shift_left )
+ _lcd_write_command(LCD_DISPLAY_SHIFT_LEFT)
end loop
- end if
+ end if
end procedure
--
----------------------------------------------------------------------------
--
----------------------------------------------------------------------------
--- shifts the complete display one position to the right
+-- lcd_shift_right - shifts the complete display one position to the right
--
----------------------------------------------------------------------------
procedure lcd_shift_right(byte in nr) is
- if nr != 0 then
+ if nr != 0 then
for nr loop
- _lcd_write_command( lcd_display_shift_right )
+ _lcd_write_command(LCD_DISPLAY_SHIFT_RIGHT)
end loop
- end if
+ end if
end procedure
--
----------------------------------------------------------------------------
- --
----------------------------------------------------------------------------
--- shifts cursor one position to the left
+--
----------------------------------------------------------------------------
+-- lcd_cursor_shift_left - shifts cursor one position to the left
--
----------------------------------------------------------------------------
procedure lcd_cursor_shift_left(byte in nr) is
- if nr != 0 then
+ if nr != 0 then
for nr loop
- _lcd_write_command( lcd_cursor_shift_l_val )
+ _lcd_write_command(LCD_CURSOR_SHIFT_L_VAL)
end loop
- end if
+ end if
end procedure
--
----------------------------------------------------------------------------
--
----------------------------------------------------------------------------
--- shifts cursor one position to the right
+-- lcd_cursor_shift_right - shifts cursor one position to the right
--
----------------------------------------------------------------------------
procedure lcd_cursor_shift_right(byte in nr) is
- if nr != 0 then
+ if nr != 0 then
for nr loop
- _lcd_write_command( lcd_cursor_shift_r_val )
+ _lcd_write_command(LCD_CURSOR_SHIFT_R_VAL)
end loop
- end if
+ end if
end procedure
--
----------------------------------------------------------------------------
---
----------------------------------------------------------------------------
--- clears the LCD (depricated)
---
----------------------------------------------------------------------------
-procedure lcd_clearscreen() is
- _lcd_write_command( lcd_clear_display )
- delay_10us( 180 )
-end procedure
--
----------------------------------------------------------------------------
--- clears the LCD
+-- lcd_clear_screen - clears the LCD
--
----------------------------------------------------------------------------
procedure lcd_clear_screen() is
- _lcd_write_command( lcd_clear_display )
+ _lcd_write_command(LCD_CLEAR_DISPLAY)
delay_10us( 180 )
end procedure
--
----------------------------------------------------------------------------
--
----------------------------------------------------------------------------
--- sets or resets cursor blink and puts display on or off
+-- lcd_cursor_blink_display - (re)sets cursor blink and puts display on/off
--
----------------------------------------------------------------------------
-procedure lcd_cursor_blink_display(bit in cursor,bit in blink,bit in
display) is
+procedure lcd_cursor_blink_display(bit in cursor, bit in blink, bit in
display) is
var byte reg
- reg = lcd_display_onoff
+ reg = LCD_DISPLAY_ONOFF
if display then reg = reg + 4 end if
if cursor then reg = reg + 2 end if
if blink then reg = reg + 1 end if
@@ -277,110 +242,87 @@
end procedure
--
----------------------------------------------------------------------------
-
-
--
----------------------------------------------------------------------------
--- cursor returns home(line 1, position 1)
+-- lcd_home - cursor returns home(line 0, position 0)
--
----------------------------------------------------------------------------
procedure lcd_home() is
- _lcd_write_command( lcd_return_home )
- delay_10us( 180 )
+ _lcd_write_command(LCD_RETURN_HOME)
+ delay_10us( 180 )
end procedure
--
----------------------------------------------------------------------------
-
--
----------------------------------------------------------------------------
--- clears the line "line" of the LCD
+-- lcd_clear_line - clears the line "line" of the LCD
--
----------------------------------------------------------------------------
-procedure lcd_clear_line( byte in line ) is
- -- set LCD-cursor at start of line
- if line == 1 then lcd_pos = 0 end if
- if line == 2 then lcd_pos = 40 end if
-
- _lcd_restore_cursor()
+procedure lcd_clear_line(byte in line) is
+ -- set LCD-cursor at start of line
+ lcd_pos = _lcd_line2index(line)
+
+ _lcd_restore_cursor()
- -- now fill line with spaces
- for 39 loop
- lcd = " "
- end loop
-
- -- set LCD back to normal operation
- _lcd_restore_cursor()
+ -- now fill line with spaces
+ for LCD_CHARS loop
+ lcd = " "
+ end loop
+
+ -- set LCD back to normal operation
+ _lcd_restore_cursor()
+
end procedure
--
----------------------------------------------------------------------------
-
-
---
-----------------------------------------------------------------------------
--- Displays a progress bar
---
---
-----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+-- lcd_progress- Displays a progress bar
+--
----------------------------------------------------------------------------
+-- (0xFF is a common pattern)
+--
----------------------------------------------------------------------------
procedure lcd_progress(byte in line, byte in amount, byte in pattern) is
- if LCD_ROWS == 1 then
- lcd_pos = pos
+ lcd_pos = _lcd_line2index(line)
+ _lcd_restore_cursor()
- elsif LCD_ROWS == 2 then
- if line == 1 then
- lcd_pos = 0
- else
- lcd_pos = 0x40
- end if
- else -- 4 lines
- if line == 1 then lcd_pos = 0
- elsif line == 2 then lcd_pos = 0x40
- elsif line == 3 then lcd_pos = 0x14
- else line == 4 then lcd_pos = 0x54
- end if
- end if
-
- _lcd_restore_cursor()
-
- for amount loop
+ for amount loop
lcd = pattern
- end loop
+ end loop
- for ( LCD_CHARS - amount) loop
- lcd = " "
- end loop
-
-end procedure
---
----------------------------------------------------------------------------
-
--- About cursor positions: the LCDs are internally 2x40 char devices.
--- The first line starts at offset 0, the second line at offset 64 (0x40).
--- With 4 line devices the third and fourth line are addressed as
extensions
--- of the first and second line by adding an offset. For a 4x20 line device
--- the offset is 20, for a 4x16 line display the offset is 16 or 20.
--- Declare the constant LCD_CHARS as appropriate for your screen
--- (you may have to specify 20 even if your display has only 16 chars!).
--- Note: Some 1x16 LCDs are implemented as 2x8 line LCDs, which means that
--- the second half of the line has to be handled as a second line.
--- ------------------------------------------------------------
--- Set cursor position
--- Specify row and column in base-0 notation (first line is 0).
--- ------------------------------------------------------------
-procedure lcd_setcursor(byte in row, byte in col) is
-
- col = col | 0b1000_0000 -- set to DRAM offset top
line
- case row of
- 1: col = col + 0x40 -- 2nd line of 2 or 4 line
lcd
- 2: col = col + LCD_CHARS -- 3rd line \ with 4x16
- 3: col = col + 0x40 + LCD_CHARS -- 4th line / or 4x20
- end case
- _lcd_write_command(col) -- set new cursor position
+ for ( LCD_CHARS - amount) loop
+ lcd = " "
+ end loop
end procedure
-
---
-----------------------------------------------------------------------------
--- Initialise display
---
-----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+-- _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(0b0001_1100) -- cursor move right
_lcd_write_command(0b0000_1100) -- display on,
cursor,blink off
_lcd_write_command(0b0000_0110) -- cursor->right, no shift
- lcd_clearscreen() -- clear screen
+ lcd_clear_screen() -- clear screen
-- (incl switch to data
char mode)
end procedure
+
+
+if (false) then
+ -- depricated procedures
+
+ --
----------------------------------------------------------------------------
+ -- clears the LCD (depricated)
+ --
----------------------------------------------------------------------------
+ procedure lcd_clearscreen() is
+ _lcd_write_command( lcd_clear_display )
+ delay_10us( 180 )
+ end procedure
+
+ procedure lcd_writechar(byte in data) is
+ _lcd_write_data(data)
+ end procedure
+
+
+end if
\ No newline at end of file
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
1 07:24:29 2009
@@ -1,5 +1,5 @@
-- ------------------------------------------------------
--- Title: Test program for lcd_hd44780_4 and lcd_hd44780_common
+-- Title: Test program for lcd_hd44780_4 and lcd_hd44780_common (extended
test)
--
-- Author: Richard Zengerink, Copyright (c) 2008..2008, all rights
reserved.
--
@@ -11,6 +11,8 @@
-- Released under the BSD license
(http://www.opensource.org/licenses/bsd-license.php)
--
-- Description: Testing lcd_hd44780_4 and lcd_hd44780_common
+-- This is to test all hd44780_common features. See test_lcd_*
+-- for a basic display test.
-- --
-- This file defines a test for JALLIB testing, using a test-board
-- defined by a BOARD file .
@@ -24,50 +26,31 @@
enable_digital_io() -- disable analog I/O (if any)
+;@jallib use chipdef
+;@jallib use lcd_hd44780_4
+;@jallib use led
-------------- OPTION register met timer0 -------------------------------
-OPTION_REG = 0B0000_0111
-;NOT_RBPU at OPTION_REG : 7 = 0 0 = weak pull-up on port B
-;intedg at OPTION_REG : 6 = 0 1 = opgaande flank interupt op RB0
-;T0CS at OPTION_REG : 5 = 0 internal instruction cycle clock
-;T0SE at OPTION_REG : 4 = 0 nvt ivm setting T0CS
-;PSA at OPTION_REG : 3 = 0 prescaler voor timer 0
-;PS2 at OPTION_REG : 2 = 1 prescaler op 256 (20Mhz/4/128) =
39062,5HZ
-;PS1 at OPTION_REG : 1 = 1 1/(39062,5/39)TMR0 = 39 >> ~1mS = tijd
van
-;PS0 at OPTION_REG : 0 = 1 timer0
-
- --------- timer1-----------
- T1CON = 0B0011_0100
-;not used at T1CON : 7 = 0
-;T1RUN at T1CON : 6 = 0 ;wordt geset als interne clock op T1
loopt
-;T1CKPS1 at T1CON : 5 = 1 ; samen met T1CKPSO prescaler
-;T1CKPS0 at T1CON : 4 = 1 ;
-;T1OSCEN at T1CON : 3 = 0 ;1 = osc is enabled 0 = osc is shut off
-;T1INSYNC at T1CON : 2 = 1 ;1 = do not sync ext. clk 0 = sync
ext.clk
-;TMR1CS at T1CON : 1 = 0 ;1 = ext. clock 0 = int. clock (Fosc/4)
-;TMR1ON at T1CON : 0 = 0 ;1 = enables timer1 0 = disables timer 1
-;
-;in is Foc/4 = 5000000/prescaler = 5000000/8 = 635000 / 625 = 1mS
-;625 = 65280 - 64655 64655/256= 252,55859375 TMR1H = 252
-;252,55859375 - 252 = 0,55859375 x 256 = 143 TMR1L = 143
-
-
- ------------- Variable -----------------------------------------------
+enable_digital_io()
+led_direction = output
-
- ------------- LCD Variables ---------
+lcd_rs_direction = output
+lcd_en_direction = output
+lcd_dataport_direction = output
include print
include ng_hd44780_4
-include js_replace
-
-
- lcd_init() ; init the lcd
+;include js_replace
+include delay
+
+lcd_init() ; init the lcd
-------------------------------------------------------------------------
-------------- Procedures -----------------------------------------------
-------------------------------------------------------------------------
+for 4 loop -- blink LED 4 times to indicate
startup
+ LED = on
+ delay_100ms(2)
+ LED = off
+ delay_100ms(2)
+end loop
@@ -93,22 +76,21 @@
const byte teststring[] = "test display"
- lcd_new_line_cursor_position (1, 1)
- lcd_clearscreen()
+ lcd_cursor_position (1, 1)
+ lcd_clear_screen()
lcd_home()
- lcd_writechar("T")
- lcd_writechar("e")
- lcd_writechar("s")
- lcd_writechar("t")
+ lcd = "T"
+ lcd = "e"
+ lcd = "s"
+ lcd = "t"
delay_100ms (10)
forever loop
- sec = 40
- lcd_new_line_cursor_position (2, 1)
+ lcd_cursor_position (2, 1)
print_string(lcd, teststring)
@@ -127,39 +109,39 @@
delay_100ms (10)
lcd_home()
delay_100ms (10)
- lcd_clearscreen()
+ lcd_clear_screen()
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)
+; 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)
+; lcd_bvalue_dp_line_pos_left_sign ( value, 0, 1, 5, true, false)
delay_100ms (20)
- lcd_clearscreen()
+ lcd_clear_screen()
- 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_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_writechar("V")
- lcd_writechar("a")
- lcd_writechar("l")
+ lcd_write_char("V")
+ lcd_write_char("a")
+ lcd_write_char("l")
- lcd_new_line_cursor_position (2, 5) ;
+ lcd_cursor_position (2, 5) ;
- lcd_writechar ("=")
+ lcd_write_char ("=")
lcd_clear_line (1)
@@ -167,36 +149,38 @@
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_new_line_cursor_position (1, 5)
- lcd_date ( day, month, year, "-", true )
-
- while sec< 60 loop
- lcd_new_line_cursor_position (2, 5)
- lcd_time ( hrs, min, sec, ":" )
- sec = sec + 1
- delay_100ms (10)
- end loop
- lcd_new_line_cursor_position (1, 5)
- lcd_date ( day, month, yearw, "/", false )
- delay_100ms (30)
+; 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)
- lcd_clearscreen()
+ lcd_clear_screen()
value1 = 0
- lcd_new_line_cursor_position (1, 5)
- lcd_writechar("=")
+ lcd_cursor_position (1, 5)
+ lcd = "="
while value1 < 255 loop
- lcd_bvalue_dp_line_pos_left_sign ( value1, 0, 1, 1, false, false)
- lcd_new_line_cursor_position (1, 7)
+; 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);
@@ -205,21 +189,21 @@
end loop
wvalue = 0
- lcd_new_line_cursor_position (2, 7)
- lcd_writechar("=")
+ lcd_cursor_position (2, 7)
+ lcd = "="
- while wvalue < 2000 loop
- lcd_wvalue_dp_line_pos_left_sign ( wvalue, 0, 2, 1, false, false)
- lcd_new_line_cursor_position (2, 9)
- print_prefix = true;
- print_byte_hex(lcd, wvalue);
-
- wvalue = wvalue + 1
- delay_1ms(5)
- end loop
+; 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_clearscreen()
+ lcd_clear_screen()
end loop
Modified: trunk/sample/test/external/lcd/test_lcd_hd44780_4.jal
==============================================================================
--- trunk/sample/test/external/lcd/test_lcd_hd44780_4.jal (original)
+++ trunk/sample/test/external/lcd/test_lcd_hd44780_4.jal Sun Mar 1
07:24:29 2009
@@ -1,5 +1,5 @@
--- ------------------------------------------------------
--- Title: Test program for lcd_hd44780_4.jal
+--
--------------------------------------------------------------------------
+-- Title: Test program for lcd_hd44780_4.jal (basic / interface test)
-- Author: Eur Van Andel, Copyright (c) 2008, all rights reserved.
-- Adapted-by: Rob Hamerling, Joep Suijs
-- Compiler: >=2.4g
@@ -11,7 +11,7 @@
-- This sample shows how to setup an LCD and writes
-- "Hello World" to the first line, using a string and the print library.
-- Line 3 and line 4 are used as well, but will work properly only on a
4x20 LCD.
--- A counter is printed to show the running forever loop.
+-- A counter is printed to show the running forever loop.
-- --
-- This file defines a test for JALLIB testing, using a test-board
-- defined by a BOARD file .
@@ -54,9 +54,9 @@
lcd_init() -- initialize LCD
print_string(lcd, str1) -- show hello world!
-lcd_setcursor(2,0) -- to 3rd line
+lcd_set_cursor(2,0) -- to 3rd line
print_string(lcd, str2)
-lcd_setcursor(3,0) -- to 4th line
+lcd_set_cursor(3,0) -- to 4th line
print_string(lcd, str3)
var byte counter = 0
@@ -64,12 +64,12 @@
forever loop -- loop forever
counter = counter + 1 -- update counter
- lcd_setcursor(1,0) -- second line
+ lcd_set_cursor(1,0) -- second line
print_byte_hex(lcd, counter) -- output in hex format
delay_100ms(3) -- wait a little
if counter == 255 then -- counter wrap
- lcd_setcursor(1,1) -- 2nd line, 2nd char
+ lcd_set_cursor(1,1) -- 2nd line, 2nd char
lcd = " " -- clear 2nd char
lcd = " " -- clear 3rd char
end if
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---