Author: robhamerling
Date: Tue Mar 3 08:26:20 2009
New Revision: 826
Added:
trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_1.jal
trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_4.jal
trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_8_1.jal
trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_1.jal
trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_4.jal
trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_1.jal
trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_4.jal
trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_8.jal
Log:
Samples for refactured lcd_hd44780 libraries,
generated with script similarly as the blink-an-LED samples
Added: trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_1.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_1.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,77 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 16f877a
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC16f877a.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 4 LCD data lines
+-- - 8 selected data bits
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:18:00.
+--
+-- ------------------------------------------------------
+--
+include 16f877a -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target LVP disabled
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var bit lcd_d4 is pin_D4 -- bit interface
+var bit lcd_d5 is pin_D5
+var bit lcd_d6 is pin_D6
+var bit lcd_d7 is pin_D7
+var bit lcd_en is pin_D3 -- data trigger
+var bit lcd_rs is pin_D2 -- command/data select.
+--
+pin_D4_direction = output -- )
+pin_D5_direction = output -- )
+pin_D6_direction = output -- )
+pin_D7_direction = output -- )
+pin_D3_direction = output -- } set port/pin directions
+pin_D2_direction = output -- )
+--
+include lcd_hd44780_4
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_4.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_4_4.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,71 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 16f877a
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC16f877a.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 4 LCD data lines
+-- - 2 data nibbles
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:18:00.
+--
+-- ------------------------------------------------------
+--
+include 16f877a -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target LVP disabled
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var byte lcd_dataport is portD_high
+var bit lcd_en is pin_D3 -- data trigger
+var bit lcd_rs is pin_D2 -- command/data select.
+--
+portD_high_direction = all_output -- )
+pin_D3_direction = output -- } set port/pin directions
+pin_D2_direction = output -- )
+--
+include lcd_hd44780_4
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_8_1.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/16f877a/16f877a_lcd_hd44780_8_1.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,85 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 16f877a
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC16f877a.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 8 LCD data lines
+-- - 8 selected data bits
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:18:00.
+--
+-- ------------------------------------------------------
+--
+include 16f877a -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target LVP disabled
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var bit lcd_d0 is pin_C4
+var bit lcd_d1 is pin_C5
+var bit lcd_d2 is pin_C6
+var bit lcd_d3 is pin_C7
+var bit lcd_d4 is pin_D4 -- bit interface
+var bit lcd_d5 is pin_D5
+var bit lcd_d6 is pin_D6
+var bit lcd_d7 is pin_D7
+var bit lcd_en is pin_D3 -- data trigger
+var bit lcd_rs is pin_D2 -- command/data select.
+--
+pin_C4_direction = output -- )
+pin_C5_direction = output -- )
+pin_C6_direction = output -- )
+pin_C7_direction = output -- )
+pin_D4_direction = output -- )
+pin_D5_direction = output -- )
+pin_D6_direction = output -- )
+pin_D7_direction = output -- )
+pin_D3_direction = output -- } set port/pin directions
+pin_D2_direction = output -- )
+--
+include lcd_hd44780_8
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_1.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_1.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,78 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 18f6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC18f6310.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 4 LCD data lines
+-- - 8 selected data bits
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:17:59.
+--
+-- ------------------------------------------------------
+--
+include 18f6310 -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+-- Configuration bits may cause a different frequency!
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target MCLR external
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var bit lcd_d4 is pin_F4 -- bit interface
+var bit lcd_d5 is pin_F5
+var bit lcd_d6 is pin_F6
+var bit lcd_d7 is pin_F7
+var bit lcd_en is pin_A2 -- data trigger
+var bit lcd_rs is pin_A3 -- command/data select.
+--
+pin_F4_direction = output -- )
+pin_F5_direction = output -- )
+pin_F6_direction = output -- )
+pin_F7_direction = output -- )
+pin_A2_direction = output -- } set port/pin directions
+pin_A3_direction = output -- )
+--
+include lcd_hd44780_4
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_4.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_4_4.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,72 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 18f6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC18f6310.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 4 LCD data lines
+-- - 2 data nibbles
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:17:58.
+--
+-- ------------------------------------------------------
+--
+include 18f6310 -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+-- Configuration bits may cause a different frequency!
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target MCLR external
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var byte lcd_dataport is portF_high
+var bit lcd_en is pin_A2 -- data trigger
+var bit lcd_rs is pin_A3 -- command/data select.
+--
+portF_high_direction = all_output -- )
+pin_A2_direction = output -- } set port/pin directions
+pin_A3_direction = output -- )
+--
+include lcd_hd44780_4
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_1.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_1.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,86 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 18f6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC18f6310.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 8 LCD data lines
+-- - 8 selected data bits
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:17:58.
+--
+-- ------------------------------------------------------
+--
+include 18f6310 -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+-- Configuration bits may cause a different frequency!
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target MCLR external
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var bit lcd_d0 is pin_F0
+var bit lcd_d1 is pin_F1
+var bit lcd_d2 is pin_F2
+var bit lcd_d3 is pin_F3
+var bit lcd_d4 is pin_F4 -- bit interface
+var bit lcd_d5 is pin_F5
+var bit lcd_d6 is pin_F6
+var bit lcd_d7 is pin_F7
+var bit lcd_en is pin_A2 -- data trigger
+var bit lcd_rs is pin_A3 -- command/data select.
+--
+pin_F0_direction = output -- )
+pin_F1_direction = output -- )
+pin_F2_direction = output -- )
+pin_F3_direction = output -- )
+pin_F4_direction = output -- )
+pin_F5_direction = output -- )
+pin_F6_direction = output -- )
+pin_F7_direction = output -- )
+pin_A2_direction = output -- } set port/pin directions
+pin_A3_direction = output -- )
+--
+include lcd_hd44780_8
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_4.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_4.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,74 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 18f6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC18f6310.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 8 LCD data lines
+-- - 2 data nibbles
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:17:57.
+--
+-- ------------------------------------------------------
+--
+include 18f6310 -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+-- Configuration bits may cause a different frequency!
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target MCLR external
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var byte lcd_dataport_low is portF_low -- nibble data interface
+var byte lcd_dataport_high is portF_high
+var bit lcd_en is pin_A2 -- data trigger
+var bit lcd_rs is pin_A3 -- command/data select.
+--
+portF_low_direction = all_output -- )
+portF_high_direction = all_output -- )
+pin_A2_direction = output -- } set port/pin directions
+pin_A3_direction = output -- )
+--
+include lcd_hd44780_8
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+end loop
+--
Added: trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_8.jal
==============================================================================
--- (empty file)
+++ trunk/sample/by_device/18f6310/18f6310_lcd_hd44780_8_8.jal Tue Mar 3
08:26:20 2009
@@ -0,0 +1,72 @@
+-- ------------------------------------------------------
+-- Title: LCD sample program for the Microchip PIC 18f6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: >=2.4i
+--
+-- 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 sample program for Microchip PIC18f6310.
+-- Shows a row of digits and letters on a 2 lines LCD.
+-- Blinks also a LED on pin_A0 to show program is running.
+-- Uses: - 8 LCD data lines
+-- - 1 full data register
+--
+-- Sources:
+--
+-- Notes:
+-- - File creation date/time: 3 Mar 2009 17:17:57.
+--
+-- ------------------------------------------------------
+--
+include 18f6310 -- target PICmicro
+--
+-- This program assumes a 20 MHz resonator or crystal
+-- is connected to pins OSC1 and OSC2.
+-- Configuration bits may cause a different frequency!
+pragma target OSC HS -- HS crystal or resonator
+pragma target clock 20_000_000 -- oscillator frequency
+pragma target WDT disabled
+pragma target MCLR external
+--
+enable_digital_io() -- disable analog I/O (if any)
+--
+pin_A0_direction = output -- LED
+--
+const byte LCD_ROWS = 2 -- LCD with 2 lines
+const byte LCD_CHARS = 16 -- and 16 characters per line
+--
+var byte lcd_dataport is portF -- full register data interface
+var bit lcd_en is pin_A2 -- data trigger
+var bit lcd_rs is pin_A3 -- command/data select.
+--
+portF_direction = all_output -- )
+pin_A2_direction = output -- } set port/pin directions
+pin_A3_direction = output -- )
+--
+include lcd_hd44780_8
+--
+lcd_init() -- init the lcd controller
+--
+include delay -- fetch delay library
+--
+forever loop
+ var byte c[LCD_CHARS] = "0123456789ABCDEF"
+ var byte i,j
+ for LCD_ROWS using i loop
+ lcd_cursor_position(i,i)
+ for LCD_CHARS - i using j loop
+ pin_A0 = !pin_A0 -- flip the LED
+ lcd_write_char(c[j])
+ delay_100ms(3)
+ end loop
+ end loop
+ delay_100ms(10)
+ lcd_clear_screen()
+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
-~----------~----~----~----~------~----~------~--~---