Author: eur.van.andel
Date: Wed Nov 19 05:32:20 2008
New Revision: 573

Modified:
    trunk/unvalidated/sample/by_device/16f877a/lcd_format.jal

Log:
fixed. will be renamed


Modified: trunk/unvalidated/sample/by_device/16f877a/lcd_format.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/lcd_format.jal   (original)
+++ trunk/unvalidated/sample/by_device/16f877a/lcd_format.jal   Wed Nov 19  
05:32:20 2008
@@ -1,6 +1,6 @@
  -- Title: How to use format lib with an LCD
  -- Author: Eur Van Andel, Copyright (c) 2008, all rights reserved.
--- Adapted-by:
+-- Adapted-by: Anonymous
  -- Compiler: >=2.4g
  --
  -- This file is part of jallib (http://jallib.googlecode.com)
@@ -19,41 +19,32 @@

  enable_digital_io()

-
-var bit  LED        is pin_a0       -- LED to see proper PIC startup
-pin_a0_direction    = output
+const byte LCD_CHARS = 20
+const byte LCD_LINES = 4

  var  bit lcd_rs        is pin_b5       -- LCD command/data select.
  var  bit lcd_en        is pin_b4       -- LCD data trigger
  var byte lcd_dataport  is portb_low    -- LCD data
-
  portb_direction     = all_output    -- LCD data is portb_low
+include lcd_hd44780_4                           -- LCD library
+lcd_init()


  include format
-include lcd_hd44780_4                           -- LCD library
  include delay

-for 4 loop
-   LED = on
-   delay_100ms(3)
-   LED = off
-   delay_100ms(3)
-end loop
-
-
  var byte counter = 0

  forever loop                                  -- loop forever

     lcd_setcursor(0, 0)
-   hd44780 = "T"    hd44780 = "e"    hd44780 = "s"    hd44780 = "t"     
hd44780 = ":"    hd44780 = " "
-   format_byte_dec (hd44780, counter, 3, 1)  -- print a byte as fixed  
point var with 1 decimal,
+   lcd = "T"    lcd = "e"    lcd = "s"    lcd = "t"    lcd = ":"    lcd  
= " "
+   format_byte_dec (lcd, counter, 3, 1)  -- print a byte as fixed point  
var with 1 decimal,
     --   3 positions (including decimal point) in total
     -- clear first part of lower line
     lcd_setcursor(1, 0)
     for 8 loop
-      hd44780 = " "
+      lcd = " "
     end loop

     -- set cursor at start of line1
@@ -63,97 +54,97 @@

        0 : block
           -- hex byte output
-         format_byte_hex(hd44780, 0xEA)
+         format_byte_hex(lcd, 0xEA)
           counter = counter + 1
        end block

        1 : block
           -- hex word output
-         format_word_hex(hd44780, 0xFD22) -- VIC20 reset vector ;-)
+         format_word_hex(lcd, 0xFD22) -- VIC20 reset vector ;-)
           counter = 10
        end block

        10 : block
           -- decimal output ' 1.2'
-         format_byte_dec(hd44780, 12, 3, 1)
+         format_byte_dec(lcd, 12, 3, 1)
           counter = counter + 1
        end block

        11 : block
           -- decimal output '0.12'
-         format_byte_dec(hd44780, 12, 3, 2)
+         format_byte_dec(lcd, 12, 3, 2)
           counter = counter + 1
        end block

        12 : block
           -- decimal output ' 12'
-         format_byte_dec(hd44780, 12, 3, 0)
+         format_byte_dec(lcd, 12, 3, 0)
           counter = counter + 1
        end block

        13 : block
           -- decimal output '12.0'
-         format_byte_dec(hd44780, 120, 3, 1)
+         format_byte_dec(lcd, 120, 3, 1)
           counter = 20
        end block

        20 : block
           -- decimal output '-12'
-         format_sbyte_dec(hd44780, -12, 3, 0)
+         format_sbyte_dec(lcd, -12, 3, 0)
           counter = counter + 1
        end block

        21 : block
           -- decimal output '-1.2'
-         format_sbyte_dec(hd44780, -12, 3, 1)
+         format_sbyte_dec(lcd, -12, 3, 1)
           counter = counter + 1
        end block

        22 : block
           -- decimal output '-12'
-         format_sbyte_dec(hd44780, -12, 3, 2)
+         format_sbyte_dec(lcd, -12, 3, 2)
           counter = 30
        end block

        30 : block
           -- decimal output ' 0.012'
-         format_word_dec(hd44780, 12, 6, 3)
+         format_word_dec(lcd, 12, 6, 3)
           counter = counter + 1
        end block

        31 : block
           -- decimal output '   1.2'
-         format_word_dec(hd44780, 12, 6, 1)
+         format_word_dec(lcd, 12, 6, 1)
           counter = counter + 1
        end block

        32 : block
           -- decimal output '   12'
-         format_word_dec(hd44780, 12, 6, 0)
+         format_word_dec(lcd, 12, 6, 0)
           counter = 40
        end block


        40 : block
           -- decimal output ' -0.012'
-         format_sword_dec(hd44780, -12, 6, 3)
+         format_sword_dec(lcd, -12, 6, 3)
           counter = 50  -- (no more examples in this group - you should get  
it by now...)
        end block

        50 : block
           -- decimal output '23:55'
-         format_time_bytes(hd44780, 23, 55)  -- 5 minutes to midnight
+         format_time_hm(lcd, 23, 55)  -- 5 minutes to midnight
           counter = counter + 1
        end block

        51 : block
           -- decimal output '23:56'
-         format_time_word(hd44780, 23 * 60 + 56)  -- 4 minutes to midnight
+         format_time_hm_word(lcd, 23 * 60 + 56)  -- 4 minutes to midnight
           counter = 99
        end block

        OTHERWISE block
-         hd44780 = "E"    hd44780 = "n"    hd44780 = "d"
+         lcd = "E"    lcd = "n"    lcd = "d"
           counter = 0
        end block

@@ -161,12 +152,7 @@
     END CASE


-   hd44780 = "<"
-
-
-
-
-
+   lcd = "<"


     delay_100ms(30)

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