Author: jsuijs
Date: Mon Feb 23 14:22:31 2009
New Revision: 809
Added:
trunk/include/jal/jascii.jal
trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal
Modified:
trunk/TORELEASE
trunk/include/external/lcd/lcd_hd44780_common.jal
trunk/include/external/lcd/ng_hd44780_4.jal
trunk/include/jal/print.jal
trunk/sample/test/board/board_16f877a_dwarf.jal
Log:
Modified: trunk/TORELEASE
==============================================================================
--- trunk/TORELEASE (original)
+++ trunk/TORELEASE Mon Feb 23 14:22:31 2009
@@ -147,6 +147,7 @@
include/jal/calendar.jal
include/jal/delay.jal
include/jal/format.jal
+include/jal/jascii.jal
include/jal/print.jal
include/jal/rtc_isr_tmr0.jal
include/jal/random.jal
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 Feb 23 14:22:31
2009
@@ -1,7 +1,7 @@
-- ------------------------------------------------------
-- Title: common for HD44780 based LCD
--
--- Author: Richard Zengerink, Copyright (c) 2008..2008, all rights
reserved.
+-- Author: Richard Zengerink, Copyright (c) 2008..2009, all rights
reserved.
--
-- Adapted-by: Joep Suijs
--
@@ -363,7 +363,6 @@
-- Initialise display
--
-----------------------------------------------------------------------------
procedure _hd44780_init() is
-
_lcd_write_command(0b0010_1000) -- 4-bits, 2 lines, 5x8
font
_lcd_write_command(0b0001_1100) -- cursor move right
Modified: trunk/include/external/lcd/ng_hd44780_4.jal
==============================================================================
--- trunk/include/external/lcd/ng_hd44780_4.jal (original)
+++ trunk/include/external/lcd/ng_hd44780_4.jal Mon Feb 23 14:22:31 2009
@@ -1,6 +1,6 @@
--
-----------------------------------------------------------------------------
-- Title: LCD library for HD44780 compatible LCDs, with 4 bits wide
datatransfer
--- Author: Rob Hamerling, Copyright (c) 2008..2008, all rights reserved.
+-- Author: Rob Hamerling, Copyright (c) 2008..2009, all rights reserved.
-- Adapted-by: Eur van Andel, Joep Suijs (refactoring)
-- Compiler: >=2.4g
--
@@ -13,7 +13,6 @@
-- 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.
-- Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en'
-- - 1 port nibble for data: 'lcd_dataport'
-- *
@@ -32,28 +31,17 @@
-- ------------- the pins which are not used the variable:
---------
-- ------------- "not_connected" and change the other pins
---------
-- ------------- according to your hardware.
---------
--- ------------- (now selected as 4 line)
---------
-- ------------- also remove the "--"
---------
--
--- var bit not_connected
---
-- var volatile bit lcd_rs is pin_e0 -- data/command select
-- var volatile bit lcd_rw is pin_e1 -- read/write select
--- var volatile bit lcd_enable is pin_e2 -- clock the data
+-- var volatile bit lcd_en is pin_e2 -- clock the data
--
--- var volatile bit lcd_d0 is not_connected
--- var volatile bit lcd_d1 is not_connected
--- var volatile bit lcd_d2 is not_connected
--- var volatile bit lcd_d3 is not_connected
-- var volatile bit lcd_d4 is pin_d4
-- var volatile bit lcd_d5 is pin_d5
-- var volatile bit lcd_d6 is pin_d6
-- var volatile bit lcd_d7 is pin_d7
--
---
--- const lcd_hardware_4line = true ;true = 4 data line, false = 8 data
line
--- const lcd_number_of_display_lines = 2 ; 1 = 1 line 2 = 2 line 4
= 4 line
--- const lcd_number_of_display_characters = 16 ; number of digits per
line
--
-- include lcd_hd44780_rz
--
Added: trunk/include/jal/jascii.jal
==============================================================================
--- (empty file)
+++ trunk/include/jal/jascii.jal Mon Feb 23 14:22:31 2009
@@ -0,0 +1,61 @@
+--
+-- file : jascii.jal
+-- author : Wouter van Ooijen
+-- date : 17-DEC-1998
+-- purpose : ascii constants
+-- requires : -
+--
+-- Copyright (C) 1998 Wouter van Ooijen
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Library General Public
+-- License as published by the Free Software Foundation; either
+-- version 2 of the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Library General Public License for more details.
+--
+-- You should have received a copy of the GNU Library General Public
+-- License along with this library; if not, write to the
+-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+-- Boston, MA 02111-1307, USA.
+--
+
+
+const byte ASCII_NULL = 00
+const byte ASCII_SOH = 01
+const byte ASCII_STX = 02
+const byte ASCII_ETX = 03
+const byte ASCII_EOT = 04
+const byte ASCII_ENQ = 05
+const byte ASCII_ACK = 06
+const byte ASCII_BEL = 07
+const byte ASCII_BS = 08
+const byte ASCII_HT = 09
+const byte ASCII_LF = 10
+const byte ASCII_VT = 11
+const byte ASCII_FF = 12
+const byte ASCII_CR = 13
+const byte ASCII_SO = 14
+const byte ASCII_SI = 15
+const byte ASCII_DLE = 16
+const byte ASCII_DC1 = 17
+const byte ASCII_DC2 = 18
+const byte ASCII_DC3 = 19
+const byte ASCII_DC4 = 20
+const byte ASCII_NAK = 21
+const byte ASCII_SYN = 22
+const byte ASCII_ETB = 23
+const byte ASCII_CAN = 24
+const byte ASCII_EM = 25
+const byte ASCII_SUB = 26
+const byte ASCII_ESC = 27
+const byte ASCII_FS = 28
+const byte ASCII_GS = 29
+const byte ASCII_RS = 30
+const byte ASCII_US = 31
+const byte ASCII_SP = 32
+
+const byte ASCII_DEL = 127
Modified: trunk/include/jal/print.jal
==============================================================================
--- trunk/include/jal/print.jal (original)
+++ trunk/include/jal/print.jal Mon Feb 23 14:22:31 2009
@@ -24,7 +24,9 @@
--
-- Notes:
--
-
+
+include jascii
+
; prototypes
procedure _print_universal_dec(volatile byte out device, dword in data,
sdword in digit_divisor, byte in digit_number)
procedure _print_suniversal_dec(volatile byte out device, sdword in data,
sdword in digit_divisor, byte in digit_number)
@@ -35,8 +37,8 @@
var bit print_prefix = false
procedure print_crlf(volatile byte out device) is
- device = 13 -- ASCII CR (cariage return)
- device = 10 -- ASCII LF (line feed)
+ device = ASCII_CR -- cariage return
+ device = ASCII_LF -- line feed
end procedure
procedure print_string(volatile byte out device, byte in str[]) is
Modified: trunk/sample/test/board/board_16f877a_dwarf.jal
==============================================================================
--- trunk/sample/test/board/board_16f877a_dwarf.jal (original)
+++ trunk/sample/test/board/board_16f877a_dwarf.jal Mon Feb 23 14:22:31 2009
@@ -51,10 +51,23 @@
var bit lcd_en is pin_b4 -- LCD data trigger
var bit lcd_en_direction is pin_b4_direction
+-- primary dataport nibble:
var byte lcd_dataport is portb_low -- LCD data port
var byte lcd_dataport_direction is portb_low_direction
+
+-- alternative dataport bits:
+var bit lcd_d4 is pin_b0
+var bit lcd_d5 is pin_b1
+var bit lcd_d6 is pin_b2
+var bit lcd_d7 is pin_b3
+var bit lcd_d4_direction is pin_b0_direction
+var bit lcd_d5_direction is pin_b1_direction
+var bit lcd_d6_direction is pin_b2_direction
+var bit lcd_d7_direction is pin_b3_direction
+
const byte LCD_ROWS = 2 -- 2 lines
const byte LCD_CHARS = 16 -- 16 chars per line
+
;@jallib section i2c
-- I2C io definition
Added: trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal
==============================================================================
--- (empty file)
+++ trunk/sample/test/external/lcd/test_display_hd44780_4_line.jal Mon Feb
23 14:22:31 2009
@@ -0,0 +1,226 @@
+-- ------------------------------------------------------
+-- Title: Test program for lcd_hd44780_4 and lcd_hd44780_common
+--
+-- Author: Richard Zengerink, Copyright (c) 2008..2008, all rights
reserved.
+--
+-- Adapted-by: Joep Suijs
+--
+-- Compiler: >=2.4g
+--
+-- This file is part of jallib (http://jallib.googlecode.com)
+-- Released under the BSD license
(http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: Testing lcd_hd44780_4 and lcd_hd44780_common
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+-- defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+-- setup: an hd44780 compatible display, used in 4-bit mode.
+--
+-- ------------------------------------------------------
+
+enable_digital_io() -- disable analog I/O (if any)
+
+
+------------- 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 -----------------------------------------------
+
+
+
+ ------------- LCD Variables ---------
+
+include print
+include ng_hd44780_4
+include js_replace
+
+
+ lcd_init() ; init the lcd
+
+------------------------------------------------------------------------
+------------- Procedures -----------------------------------------------
+------------------------------------------------------------------------
+
+
+
+--------------------------------------------------------------------------
+------------- MAIN program -----------------------------------------------
+--------------------------------------------------------------------------
+
+
+
+
+ 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_new_line_cursor_position (1, 1)
+ lcd_clearscreen()
+ lcd_home()
+
+
+ lcd_writechar("T")
+ lcd_writechar("e")
+ lcd_writechar("s")
+ lcd_writechar("t")
+ delay_100ms (10)
+
+
+ forever loop
+
+ sec = 40
+ lcd_new_line_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)
+ 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_clearscreen()
+
+ 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_clearscreen()
+
+ 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_new_line_cursor_position (2, 5) ;
+
+ lcd_writechar ("=")
+
+
+ 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_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)
+
+ lcd_clearscreen()
+
+ value1 = 0
+ lcd_new_line_cursor_position (1, 5)
+ lcd_writechar("=")
+ while value1 < 255 loop
+ lcd_bvalue_dp_line_pos_left_sign ( value1, 0, 1, 1, false, false)
+ lcd_new_line_cursor_position (1, 7)
+ print_prefix = true;
+ print_byte_hex(lcd, value1);
+
+ value1 = value1 + 1
+ delay_1ms(250)
+ end loop
+
+ wvalue = 0
+ lcd_new_line_cursor_position (2, 7)
+ lcd_writechar("=")
+
+
+ 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
+
+ lcd_clearscreen()
+
+ end 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
-~----------~----~----~----~------~----~------~--~---