Revision: 1661
Author: jsuijs
Date: Sat Feb 13 05:16:03 2010
Log: preparation of samples for starters guide.
http://code.google.com/p/jallib/source/detail?r=1661

Added:
 /trunk/sample/16f877a_in_and_out.jal
 /trunk/test/board/board_16f877a_startersguide.jal
 /trunk/test/jal/test_in_and_out.jal
 /trunk/test/jal/test_startersguide_1_serial.jal
Deleted:
 /trunk/test/jal/test_blink_ii.jal

=======================================
--- /dev/null
+++ /trunk/sample/16f877a_in_and_out.jal        Sat Feb 13 05:16:03 2010
@@ -0,0 +1,63 @@
+-- ------------------------------------------------------
+-- Title: in & out test
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2010, all rights reserved.
+--
+-- Adapted-by:
+--
+-- 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: Test program for digital in and out. LED blinks, Button selects blink rate
+--
+-- Sources:
+--
+-- Notes:
+--
+-- ------------------------------------------------------
+--
+-- This file has been generated from:
+--    * board: board_16f877a_startersguide.jal
+--    * test : test_in_and_out.jal
+--
+
+;@jallib section chipdef
+-- chip setup
+include 16f877a
+
+pragma target clock 20_000_000                  -- xtal frequency
+pragma target OSC        hs
+pragma target   LVP disabled
+pragma target   WDT disabled
+;@jallib section led
+-- LED IO definition
+alias led             is pin_c2
+alias led_direction   is pin_c2_direction
+;@jallib section button
+-- button IO definition
+alias button             is pin_c0
+alias button_direction   is pin_c0_direction
+
+include delay
+
+enable_digital_io()
+
+led_direction = output
+
+procedure my_delay() is
+   if (button) then
+     delay_1ms(250)
+   else
+     delay_1ms(100)
+   end if
+end procedure
+
+forever loop
+  led = on
+  my_delay()
+  led = off
+  my_delay()
+end loop
+--
=======================================
--- /dev/null
+++ /trunk/test/board/board_16f877a_startersguide.jal Sat Feb 13 05:16:03 2010
@@ -0,0 +1,81 @@
+-- ------------------------------------------------------
+-- Title: BOARD FILE for [see filename]
+-- Author: Joep Suijs, Copyright (c) 2008..2010, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4l
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license (http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: This file defines the configuration of a specific test-board.
+-- --
+-- BOARD DESCRIPTION
+-- -----------------
+-- --
+-- DB01 - Dwarf board with 16f877a and:
+-- --
+-- A0: analog input (potmeter)
+-- C0: Button + pull-up resistor
+-- C2: LED
+-- C3: I2C SCL
+-- C4: I2C SDA
+-- --
+-- DB017 with 2x16 LCD display on port D
+--    D0
+3: LCD Data nibble
+--    D4: LCD Enable
+--    D5: LCD R/S
+-- --
+--
+--
+-- Sources:
+--
+-- Notes:
+--
+-- ------------------------------------------------------
+
+-- This board is used as a reference while generating samples
+;@jallib preferred
+
+;@jallib section chipdef
+-- chip setup
+include 16f877a
+
+pragma target clock 20_000_000                  -- xtal frequency
+pragma target OSC        hs
+pragma target   LVP disabled
+pragma target   WDT disabled
+
+;@jallib section led
+-- LED IO definition
+alias led             is pin_c2
+alias led_direction   is pin_c2_direction
+
+;@jallib section button
+-- button IO definition
+alias button             is pin_c0
+alias button_direction   is pin_c0_direction
+
+;@jallib section serial
+const serial_hw_baudrate = 115_200
+
+;@jallib section lcd_hd44780_4
+-- LCD IO definition
+alias lcd_rs           is pin_d5              -- LCD command/data select.
+alias lcd_rs_direction is pin_d5_direction
+alias lcd_en           is pin_d4              -- LCD data trigger
+alias lcd_en_direction is pin_d4_direction
+
+-- dataport nibble:
+alias lcd_dataport is portd_low              -- LCD data  port
+alias lcd_dataport_direction is portd_low_direction
+
+const byte LCD_ROWS     = 2                     -- 2 lines
+const byte LCD_CHARS    = 16                    -- 16 chars per line
+
+;@jallib section i2c
+-- I2C io definition
+alias i2c_scl            is pin_c3
+alias i2c_scl_direction  is pin_c3_direction
+alias i2c_sda            is pin_c4
+alias i2c_sda_direction  is pin_c4_direction
=======================================
--- /dev/null
+++ /trunk/test/jal/test_in_and_out.jal Sat Feb 13 05:16:03 2010
@@ -0,0 +1,45 @@
+-- ------------------------------------------------------
+-- Title: in & out test
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2010, all rights reserved.
+--
+-- Adapted-by:
+--
+-- 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: Test program for digital in and out. LED blinks, Button selects blink rate
+--
+-- Sources:
+--
+-- Notes:
+--
+-- ------------------------------------------------------
+
+;@jallib use chipdef
+;@jallib use led
+;@jallib use button
+
+include delay
+
+enable_digital_io()
+
+led_direction = output
+
+procedure my_delay() is
+   if (button) then
+     delay_1ms(250)
+   else
+     delay_1ms(100)
+   end if
+end procedure
+
+forever loop
+  led = on
+  my_delay()
+  led = off
+  my_delay()
+end loop
+--
=======================================
--- /dev/null
+++ /trunk/test/jal/test_startersguide_1_serial.jal     Sat Feb 13 05:16:03 2010
@@ -0,0 +1,165 @@
+-- ------------------------------------------------------
+-- Title: Test program 1 for startersguide (serial interface)
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2010, all rights reserved.
+--
+-- Adapted-by:
+--
+-- 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: Test program
+--
+-- Sources:
+--
+-- Notes: as output, this sample produces characters on a serial link.
+--
+-- ------------------------------------------------------
+
+;@jallib use chipdef
+;@jallib use led
+
+include delay
+
+-- set all IO as digital
+enable_digital_io()
+
+
+-- setup serial (see echo.jal for more details)
+;@jallib use serial
+include serial_hardware
+serial_hw_init()
+
+alias sg_output = serial_hardware_data
+
+include print
+
+led_direction = output
+
+forever loop
+   delay_100ms( 5 )
+   LED = high
+   delay_100ms( 5 )
+   LED = low
+
+   -- serial_hw_data is a pseudo-var of the desired output-device.
+   serial_hw_data = "A" -- output an A to the serial port.
+
+   --
+ -- The print_* and format_* routines assing the output chars to this pseudo-var.
+   --
+
+   -- output the string, the pseudo var is the first param.
+   const byte str1[] = " - Test print.jal- bytes\r\n"   -- define a string
+   print_string(serial_hw_data, str1)                 -- output string
+-- print_string(serial_hw_data, " - Test print.jal- bytes\r\n") -- output string (not yet supported by JAL)
+
+   -- -----------
+   -- byte stuff
+   -- -----------
+   var  byte a =  210
+   var sbyte b = -109
+
+ print_byte_dec(serial_hw_data, a) -- output in (unsigned) decimal format + print_crlf(serial_hw_data) -- output Carriage Return and Linefeed (0x0D 0x0A), new line
+   print_byte_hex(serial_hw_data, a)   -- output in hex format
+   print_crlf(serial_hw_data)
+   print_byte_binary(serial_hw_data, a)   -- output in binary format
+   print_crlf(serial_hw_data)
+
+   print_sbyte_dec(serial_hw_data, b)   -- output in signed decimal format
+   print_crlf(serial_hw_data)
+
+
+   -- -----------
+   -- word stuff
+   -- -----------
+   const byte str2[] = "Test print.jal - words\r\n"   -- define a string
+   print_string(serial_hw_data, str2)
+
+   var  word c =  45678
+   var sword d = -32109
+
+ print_word_dec(serial_hw_data, c) -- output in (unsigned) decimal format + print_crlf(serial_hw_data) -- output Carriage Return and Linefeed (0x0D 0x0A), new line
+   print_word_hex(serial_hw_data, c)   -- output in hex format
+   print_crlf(serial_hw_data)
+   print_word_binary(serial_hw_data, c)   -- output in binary format
+   print_crlf(serial_hw_data)
+
+   print_sword_dec(serial_hw_data, d)   -- output in signed decimal format
+   print_crlf(serial_hw_data)
+
+   -- -----------
+   -- dword stuff
+   -- -----------
+   const byte str3[] = "Test print.jal - dwords\r\n"   -- define a string
+   print_string(serial_hw_data, str3)
+
+   var  dword e =  3210987654
+   var sdword f = -2109876543
+
+ print_dword_dec(serial_hw_data, e) -- output in (unsigned) decimal format + print_crlf(serial_hw_data) -- output Carriage Return and Linefeed (0x0D 0x0A), new line
+   print_dword_hex(serial_hw_data, e)   -- output in hex format
+   print_crlf(serial_hw_data)
+   print_dword_binary(serial_hw_data, e)   -- output in binary format
+   print_crlf(serial_hw_data)
+
+   print_sdword_dec(serial_hw_data, f)   -- output in signed decimal format
+   print_crlf(serial_hw_data)
+
+   -- -----------
+   -- bit stuff
+   -- -----------
+   const byte str4[] = "Test print.jal - bit\r\n"   -- define a string
+   print_string(serial_hw_data, str4)
+
+   var bit g = 1
+
+   print_bit_10(serial_hw_data, g)           -- output 0 or 1
+   serial_hw_data = " "                      -- output a space
+
+   print_bit_highlow(serial_hw_data, g)      -- output text 'high' or 'low'
+   serial_hw_data = " "                      -- output a space
+
+ print_bit_truefalse(serial_hw_data, g) -- output text 'true' or 'false'
+   serial_hw_data = " "                      -- output a space
+
+   g = 0
+
+   print_bit_10(serial_hw_data, g)           -- output 0 or 1
+   serial_hw_data = " "                      -- output a space
+
+   print_bit_highlow(serial_hw_data, g)      -- output text 'high' or 'low'
+   serial_hw_data = " "                      -- output a space
+
+ print_bit_truefalse(serial_hw_data, g) -- output text 'true' or 'false'
+
+   print_crlf(serial_hw_data)
+
+
+   -- -------------
+   -- and together:
+   -- -------------
+
+   var byte x = "y"
+   const byte str5[] = "Variable x has decimal value "
+   print_string(serial_hw_data, str5)
+   print_byte_dec(serial_hw_data, x)
+
+   const byte str6[] = " which is hex value "
+   print_string(serial_hw_data, str6)
+   print_byte_hex(serial_hw_data, x)
+
+   const byte str7[] = " and represents ASCII character "
+   print_string(serial_hw_data, str7)
+   serial_hw_data = x
+
+   print_crlf(serial_hw_data)
+   print_crlf(serial_hw_data)
+
+end loop
+
=======================================
--- /trunk/test/jal/test_blink_ii.jal   Thu Nov 12 13:40:18 2009
+++ /dev/null
@@ -1,35 +0,0 @@
--- ------------------------------------------------------
--- Title: Blink-an-LED of the Microchip PIC*
---
--- Author: Rob Hamerling, Copyright (c) 2008..2008, all rights reserved.
---
--- Adapted-by: Joep Suijs (universal test file)
---
--- 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: Sample blink-an-LED program for Microchip PIC16f628a
---
--- Sources:
---
--- Notes:
---  - File creation date/time: 22 Aug 2008 13:36:27.
---
--- ------------------------------------------------------
-
-;@jallib use chipdef
-;@jallib use led
-
-enable_digital_io()
---
-led_direction = output
---
-forever loop
-  led = on
-  _usec_delay(250000)
-  led = off
-  _usec_delay(250000)
-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.

Reply via email to