Author: jsuijs
Date: Mon Mar 2 10:54:50 2009
New Revision: 825
Removed:
trunk/include/external/lcd/ng_hd44780_4.jal
trunk/include/external/lcd/ng_hd44780_8.jal
Modified:
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/sample/test/external/lcd/test_display_hd44780_4_line.jal
trunk/sample/test/external/lcd/test_lcd_hd44780_4.jal
Log:
new lcd libs now replace the old ones.
Modified: trunk/include/external/lcd/lcd_hd44780_4.jal
==============================================================================
--- trunk/include/external/lcd/lcd_hd44780_4.jal (original)
+++ trunk/include/external/lcd/lcd_hd44780_4.jal Mon Mar 2 10:54:50 2009
@@ -1,7 +1,7 @@
--
-----------------------------------------------------------------------------
-- Title: LCD library for HD44780 compatible LCDs, with 4 bits wide
datatransfer
--- Author: Rob Hamerling, Copyright (c) 2008..2008, all rights reserved.
--- Adapted-by: Eur van Andel
+-- Author: Rob Hamerling, Copyright (c) 2008..2009, all rights reserved.
+-- Adapted-by: Eur van Andel, Joep Suijs (refactoring)
-- Compiler: >=2.4g
--
-- This file is part of jallib (http://jallib.googlecode.com)
@@ -10,159 +10,150 @@
-- Sources:
--
-- Description:
--- Simple interface for HD44780 compatible alphanumeric LCD screens.
--- Screens can range from 2x8 (2 lines, 8 chars) to 4x20.
--- Uses 4 bit wide datapath + 2 handshake lines (total 6 PIC pins).
--- No support for shift and characterset manipulations.
+-- 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
+-- - 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.
+-- --
-- Directions for use of this library in application programs
-- (in this sequence):
-- 1. Declare the following constants:
-- 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
--- 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
+-- 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
+-- --
+-- 2. Set the chosen LCD dataport and handshake pins to output:
-- pin_A4_direction = output
-- pin_A5_direction = 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:
--- Bits 0..3 of portA are used for data, pins 4 and 5 of portA are
--- used for handshake. Any other available nibble and handshake pins
--- could be used (provided these are configurable for output).
--- *
--- Available functions for application programs:
--- lcd_init() initialize the LCD
controller
--- lcd_clearscreen() clear screen, cursor home
--- lcd_setcursor(<row>,<column>) where to write next
character
--- lcd_writechar(<byte>) write single character
--- at cursor position and
--- shift cursor position 1
right
--- *
--- A pseudo byte variable 'lcd' is declared as alternative for
lcd_writechar(<byte>)
--- So in stead of: lcd_writechar(<byte>)
--- you may use: lcd = <byte>
--- And you may also use 'lcd' as destination in functions of other
--- libraries, like print().
---
+-- --
+-- See hd_44780_common for the LCD API.
--
-- Dependencies: delay.jal
--
--
-----------------------------------------------------------------------------
-include delay -- standard delay procedures
+include delay
--- -----------------------------------------------------
--- Write nibble (lower order 4 bits of byte) to LCD.
--- Nibble is sent to dataport.
--- lcd_rs is not touched: function can be used for commands and data.
--- When wait is required after write then caller should wait
--- (in 4-bit mode only required after second nibble).
--- -----------------------------------------------------
-procedure _lcd_writenibble(byte in data) is
+--
----------------------------------------------------------------------------
+-- sends low nibble from value to the LCD
+-- can be used for both commands and data
+-- (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
+ ;pragma inline
+
+ if (defined(lcd_dataport) == TRUE) then
+ -- write nibble at once
+ lcd_dataport = value -- replace low nibble
+ 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
+ lcd_d6 = bit2
+ lcd_d7 = bit3
+ end if
- lcd_dataport = data -- replace low nibble
+ -- generate clockpuls
lcd_en = HIGH -- trigger on
asm nop -- delay (> 400 ns)
lcd_en = LOW -- trigger off
end procedure
+--
----------------------------------------------------------------------------
--- ----------------------------------------------------------
--- Send byte to the LCD as 2 nibbles (most significant nibble first)
--- and automatically set the cursor one position right.
--- There is no check on line overflow.
--- ----------------------------------------------------------
-procedure lcd_writechar(byte in c) is
- _lcd_writenibble(c >> 4) -- write high nibble
- _lcd_writenibble(c) -- write low nibble
+--
----------------------------------------------------------------------------
+-- sends byte from value to register of the LCD
+-- (this procedure is only used inside this file)
+--
+--
----------------------------------------------------------------------------
+procedure __lcd_write( byte in value ) is
+ __lcd_write_nibble(value >> 4) -- write high nibble
+ __lcd_write_nibble(value) -- write low nibble
delay_10us(4) -- > 37 us
-
end procedure
+--
----------------------------------------------------------------------------
--- ----------------------------------------------------------
--- Pseudo variable 'lcd' as alternative for lcd_writechar(<byte>)
--- ----------------------------------------------------------
-procedure lcd'put(byte in c) is
- lcd_writechar(c)
+--
----------------------------------------------------------------------------
+-- sends data byte in value to LCD
+-- for slow commands an extra delay should be added
+--
+--
----------------------------------------------------------------------------
+procedure _lcd_write_data(byte in value) is
+ lcd_rs = high -- select instruction
+ __lcd_write( value ) -- output byte
end procedure
+--
----------------------------------------------------------------------------
--- ------------------------------------------------------------
--- Clear screen
--- (and set the cursor to the upper left corner: row 0, column 0)
--- ------------------------------------------------------------
-procedure lcd_clearscreen() is
-
- lcd_rs = LOW -- set to control char mode
- lcd_writechar(0b0000_0001) -- clear screen, cursor
home
- delay_1ms(2) -- > 1.5 ms
- lcd_rs = HIGH -- set to data char mode
-
+--
----------------------------------------------------------------------------
+-- 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
+ lcd_rs = low -- select instruction
+ __lcd_write( value ) -- output byte
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_rs = LOW -- set to control char mode
- lcd_writechar(col) -- set new cursor position
- lcd_rs = HIGH -- set to data char mode
-
-end procedure
-
+-- now we defined the interface, add the API
+include lcd_hd44780_common
--- -----------------------------------------------------
--- Initialize LCD
--- * for 4-bit data mode
--- * 2-line (/ 4-line) mode
--- * shift right, invisible cursor
--- -----------------------------------------------------
-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_writenibble(0b0000_0011) -- function set
+ __lcd_write_nibble(0b0000_0011) -- function set
delay_1ms(5) -- > 4.1 milliseconds
- _lcd_writenibble(0b0000_0011) -- function set
- delay_10us(10) -- > 100 �s
- _lcd_writenibble(0b0000_0011) -- function set
- delay_10us(4) -- > 37 �s
- _lcd_writenibble(0b0000_0010) -- to 4-bit mode
- delay_10us(4) -- > 37 �s
- lcd_writechar(0b0010_1000) -- 4-bits, 2 lines, 5x8
font
- lcd_writechar(0b0001_1100) -- cursor move right
- lcd_writechar(0b0000_1100) -- display on,
cursor,blink off
- lcd_writechar(0b0000_0110) -- cursor->right, no shift
- lcd_clearscreen() -- clear screen
- -- (incl switch to data
char mode)
-end procedure
-
+ __lcd_write_nibble(0b0000_0011) -- function set
+ delay_10us(10) -- > 100 us
+ __lcd_write_nibble(0b0000_0011) -- function set
+ delay_10us(4) -- > 37 us
+ __lcd_write_nibble(0b0000_0010) -- to 4-bit mode
+ delay_10us(4) -- > 37 us
+ -- init the API
+ _hd44780_init()
+end procedure
Modified: trunk/include/external/lcd/lcd_hd44780_8.jal
==============================================================================
--- trunk/include/external/lcd/lcd_hd44780_8.jal (original)
+++ trunk/include/external/lcd/lcd_hd44780_8.jal Mon Mar 2 10:54:50 2009
@@ -1,8 +1,8 @@
--
-----------------------------------------------------------------------------
-- Title: LCD library for HD44780 compatible LCDs, with 8 bits wide
datatransfer
--- Author: Rob Hamerling, Copyright (c) 2008..2008, all rights reserved.
--- Adapted-by:
--- Compiler: >=2.4i
+-- Author: Rob Hamerling, Copyright (c) 2008..2009, all rights reserved.
+-- Adapted-by: Eur van Andel, Joep Suijs (refactoring)
+-- Compiler: >=2.4g
--
-- This file is part of jallib (http://jallib.googlecode.com)
-- Released under the ZLIB license
(http://www.opensource.org/licenses/zlib-license.html)
@@ -10,141 +10,157 @@
-- Sources:
--
-- Description:
--- Simple interface for HD44780 compatible alphanumeric LCD screens.
--- Screens can range from 2x8 (2 lines, 8 chars) to 4x20.
+-- Port interface for HD44780 compatible alphanumeric LCD screens.
-- Uses 8 bit wide datapath + 2 handshake lines (total 10 PIC pins).
--- No support for shift and characterset manipulations.
-- Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
-- - 1 complete port for data: 'lcd_dataport'
--- *
+-- 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
+-- faster and more compact code then random selected data
lines.
+-- --
-- Directions for use of this library in application programs
-- (in this sequence):
-- 1. Declare the following constants:
-- 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_A3 -- trigger
--- var bit lcd_rs is pin_A2 -- 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:
--- portF_direction = all_output
--- pin_A2_direction = output
--- pin_A3_direction = output
+-- 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
+-- var bit lcd_d3 is is pin_C7 -- databit d3 pin
+-- var bit lcd_d4 is is pin_B0 -- databit d4 pin
+-- 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
+-- --
+-- 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
+-- --
+-- 3. Include this library.
+-- --
-- 4. Call lcd_init() to initialize the lcd controller.
--- Above is an example for a 2x16 LCD:
--- portA is used for data, pins 6 and 7 of portB are used for
--- handshake. Any other available port and handshake pins
--- could be used (provided these are configurable for output).
--- *
--- Available functions for application programs:
--- lcd_init() initialize the LCD
controller
--- lcd_clearscreen() clear screen, cursor
home
--- lcd_setcursor(<row>,<column>) where to write next
character
--- lcd_writechar(<byte>) write single character
--- at cursor position and
--- shift display position
1 right
--- *
--- A pseudo byte variable 'lcd' is declared as alternative for
lcd_writechar(<byte>)
--- So in stead of: lcd_writechar(<byte>)
--- you may use: lcd = <byte>
--- And you may also use 'lcd' as destination in functions of other
--- libraries, like print().
---
+-- --
+-- Above is an example for a 2x16 LCD.
+-- --
+-- See hd_44780_common for the LCD API.
--
-- Dependencies: delay.jal
--
--
-----------------------------------------------------------------------------
+--
-include delay -- standard delay procedures
+include delay
--- -----------------------------------------------------
--- Write character to LCD.
--- lcd_rs is not touched: function can be used for commands and data.
--- -----------------------------------------------------
-procedure lcd_writechar(byte in data) is
+--
----------------------------------------------------------------------------
+-- sends byte from value to register of the LCD
+-- (this procedure is only used inside this file)
+--
+--
----------------------------------------------------------------------------
+procedure __lcd_write( byte in value ) is
+ 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
+ var bit bit2 at value : 2
+ var bit bit3 at value : 3
+ var bit bit4 at value : 4
+ 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
+ lcd_d2 = bit2
+ lcd_d3 = bit3
+ lcd_d4 = bit4
+ lcd_d5 = bit5
+ lcd_d6 = bit6
+ lcd_d7 = bit7
+ end if
- lcd_dataport = data -- replace low nibble
lcd_en = HIGH -- trigger on
asm nop -- delay (> 400 ns)
lcd_en = LOW -- trigger off
delay_10us(4) -- > 37 us
-
end procedure
+--
----------------------------------------------------------------------------
--- ----------------------------------------------------------
--- Pseudo variable 'lcd' as alternative for lcd_writechar(<byte>)
--- ----------------------------------------------------------
-procedure lcd'put(byte in c) is
- lcd_writechar(c)
-end procedure
-
-
--- ------------------------------------------------------------
--- Clear screen
--- (and set the cursor to the upper left corner: row 0, column 0)
--- ------------------------------------------------------------
-procedure lcd_clearscreen() is
-
- lcd_rs = LOW -- set to control char mode
- lcd_writechar(0b0000_0001) -- clear screen, cursor
home
- delay_1ms(2) -- > 1.5 ms
- lcd_rs = HIGH -- set to data char mode
+--
----------------------------------------------------------------------------
+-- sends data byte in value to LCD
+-- for slow commands an extra delay should be added
+--
+--
----------------------------------------------------------------------------
+procedure _lcd_write_data(byte in value) is
+ lcd_rs = high -- select instruction
+ __lcd_write( value ) -- output byte
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_rs = LOW -- set to control char mode
- lcd_writechar(col) -- set new cursor position
- lcd_rs = HIGH -- set to data char mode
-
+--
----------------------------------------------------------------------------
+-- 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
+ lcd_rs = low -- select instruction
+ __lcd_write( value ) -- output byte
end procedure
+--
----------------------------------------------------------------------------
--- -----------------------------------------------------
--- Initialize LCD
--- * for 4-bit data mode
--- * 2-line (/ 4-line) mode
--- * shift right, invisible cursor
--- -----------------------------------------------------
-procedure lcd_init() is
+-- now we defined the interface, add the API
+include lcd_hd44780_common
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+--
----------------------------------------------------------------------------
+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_writechar(0b0011_0000) -- function set (8-bits
interface)
- delay_1ms(5) -- wait (> 4.1 ms)
- lcd_writechar(0b0011_0000) -- function set (8-bits
interface)
- delay_10us(15) -- wait (> 100 us)
- lcd_writechar(0b0011_0000) -- function set (8-bits
interface)
- delay_10us(15) -- wait (> 100 us)
- lcd_writechar(0b0011_1000) -- 8 bits, 2 lines, 5x8
font
- lcd_writechar(0b0001_1100) -- display shift right
- lcd_writechar(0b0000_1100) -- display on,
cursor,blink off
- lcd_writechar(0b0000_0110) -- cursor->right, no shift
- lcd_clearscreen() -- clear screen
- -- (incl switch to data
char mode)
-end procedure
-
+ _lcd_write_command(0b0011_0000) -- function set
+ delay_1ms(5) -- > 4.1 milliseconds
+ _lcd_write_command(0b0011_0000) -- function set
+ delay_10us(10) -- > 100 us
+ _lcd_write_command(0b0011_0000) -- function set
+ delay_10us(4) -- > 37 us
+ _lcd_write_command(0b0011_1000) -- to 8-bit mode
+ delay_10us(4) -- > 37 us
+ -- init the API
+ _hd44780_init()
+end procedure
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 Mon Mar 2 10:54:50
2009
@@ -309,7 +309,15 @@
end procedure
-if (false) then
+-- set:
+-- const bit no_depricated_functions = true
+-- if you don't want to have depricated functions
+if (defined(no_depricated_functions) == false) then
+ const bit no_depricated_functions = false
+end if
+
+if (no_depricated_functions == false) then
+
-- depricated procedures
--
----------------------------------------------------------------------------
@@ -323,6 +331,5 @@
procedure lcd_writechar(byte in data) is
_lcd_write_data(data)
end procedure
-
end if
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 Mon Mar
2 10:54:50 2009
@@ -39,7 +39,7 @@
lcd_dataport_direction = output
include print
-include ng_hd44780_4
+include lcd_hd44780_4
;include js_replace
include delay
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 Mon Mar 2
10:54:50 2009
@@ -37,7 +37,7 @@
lcd_dataport_direction = output
;include lcd_hd44780_4 -- LCD library with 4 data lines
-include ng_hd44780_4
+include lcd_hd44780_4
include print -- formatted output library
for 4 loop -- blink LED 4 times to indicate
startup
@@ -54,9 +54,9 @@
lcd_init() -- initialize LCD
print_string(lcd, str1) -- show hello world!
-lcd_set_cursor(2,0) -- to 3rd line
+lcd_cursor_position(2,0) -- to 3rd line
print_string(lcd, str2)
-lcd_set_cursor(3,0) -- to 4th line
+lcd_cursor_position(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_set_cursor(1,0) -- second line
+ lcd_cursor_position(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_set_cursor(1,1) -- 2nd line, 2nd char
+ lcd_cursor_position(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
-~----------~----~----~----~------~----~------~--~---