Author: jsuijs
Date: Wed Dec 24 01:10:40 2008
New Revision: 647

Added:
    trunk/unvalidated/sample/by_device/16f648a/sample_i2c_sw_l1.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_i2c_sw_l1.jal
    trunk/unvalidated/sample/by_device/16f88/sample_i2c_sw_l1.jal
Modified:
    trunk/unvalidated/sample/by_device/16f648a/sample_blink.jal
    trunk/unvalidated/sample/by_device/16f648a/sample_lcd_hd44780_4.jal
    trunk/unvalidated/sample/by_device/16f648a/sample_pwm1.jal
    trunk/unvalidated/sample/by_device/16f648a/sample_serial_hardware.jal
    trunk/unvalidated/sample/by_device/16f648a/sample_serial_print.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_blink.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_lcd_hd44780_4.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_pwm1.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_pwm2.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_serial_hardware.jal
    trunk/unvalidated/sample/by_device/16f877a/sample_serial_print.jal
    trunk/unvalidated/sample/by_device/16f88/sample_blink.jal
    trunk/unvalidated/sample/by_device/16f88/sample_lcd_hd44780_4.jal
    trunk/unvalidated/sample/by_device/16f88/sample_pwm1.jal
    trunk/unvalidated/sample/by_device/16f88/sample_serial_hardware.jal
    trunk/unvalidated/sample/by_device/16f88/sample_serial_print.jal
    trunk/unvalidated/sample/test/board/board_16f88_js.jal

Log:
added a few samples (and regenerated all)

Modified: trunk/unvalidated/sample/by_device/16f648a/sample_blink.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f648a/sample_blink.jal (original)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_blink.jal Wed Dec 24  
01:10:40 2008
@@ -18,7 +18,7 @@
  --  - File creation date/time: 22 Aug 2008 13:36:27.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:34 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:16 2008, from:
  --    * board: board_16f648a_js.jal
  --    * test : test_blink.jal
  --
@@ -36,8 +36,10 @@

  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  enable_digital_io()
  --

Added: trunk/unvalidated/sample/by_device/16f648a/sample_i2c_sw_l1.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_i2c_sw_l1.jal     Wed Dec 
 
24 01:10:40 2008
@@ -0,0 +1,111 @@
+-- ------------------------------------------------------
+-- Title: Test program for i2c_hardware.jal
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2008, 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: Level 0 i2c test program
+--    interact with an i2c eeprom using the i2c primitives
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+--  defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+--    setup:
+--         an 24lc256 i2c eeprom, connected to the test board i2c pins.
+--         a serial connection to a terminal
+--
+-- --------------------------------------------------------
+-- This file has been generated on Wed Dec 24 10:10:25 2008, from:
+--    * board: board_16f648a_js.jal
+--    * test : test_i2c_sw_l1.jal
+--
+;@jallib section chipdef
+-- chip setup
+include 16f648a
+
+--
+-- 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
+
+;@jallib section i2c
+-- I2C io definition
+var volatile bit i2c_scl            is pin_b4
+var volatile bit i2c_scl_direction  is pin_b4_direction
+var volatile bit i2c_sda            is pin_b3
+var volatile bit i2c_sda_direction  is pin_b3_direction
+
+-- generic setup (see releated examples for more details)
+const usart_hw_serial = true   -- true = RS232, false = SPI
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+include print
+include delay
+
+-- i2c setup
+const word _i2c_bus_speed = 1 ; * 100kHz
+const bit _i2c_level = true   ; i2c levels (not SMB)
+
+include i2c_software
+;include i2c_hardware
+
+i2c_initialize()
+
+
+var byte i2c_tx_buffer[10]
+var byte i2c_rx_buffer[10]
+
+include i2c_level1
+
+-- we're alive
+const byte str1[] = "Test.\r\n"
+print_string(serial_hw_data, str1)
+
+
+var bit r
+var byte i
+forever loop
+
+   -- Send 2 bytes address to device 0xA0 and then read 3 bytes of data
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 0  -- low byte address within i2c eeprom
+   r = i2c_send_receive(0xA0, 2, 3)
+
+;   -- same as above
+;   r = i2c_receive_wordaddr(0xA0, 0x0000, 3)
+
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[0]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[1]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[2]);
+   serial_hw_data = " "
+
+   -- write part (increment 3rd byte at 0x0002)
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 2  -- low byte address within i2c eeprom
+   i2c_tx_buffer[2] = i2c_rx_buffer[2] + 1  -- data
+   r = i2c_send_receive(0xA0, 3, 0)
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_crlf(serial_hw_data)
+
+   delay_100ms(10)
+end loop

Modified:  
trunk/unvalidated/sample/by_device/16f648a/sample_lcd_hd44780_4.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f648a/sample_lcd_hd44780_4.jal  
(original)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_lcd_hd44780_4.jal Wed  
Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  -- setup: an hd44780 compatible display, used in 4-bit mode.
  --
  --  
----------------------------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:30 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:16 2008, from:
  --    * board: board_16f648a_js.jal
  --    * test : test_lcd_hd44780_4.jal
  --
@@ -51,8 +51,10 @@
  const byte LCD_CHARS    = 16                    -- 16 chars per line
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  enable_digital_io()


Modified: trunk/unvalidated/sample/by_device/16f648a/sample_pwm1.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f648a/sample_pwm1.jal  (original)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_pwm1.jal  Wed Dec 24  
01:10:40 2008
@@ -17,7 +17,7 @@
  -- Notes: setup: a led on ccp1
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:35 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:22 2008, from:
  --    * board: board_16f648a_js.jal
  --    * test : test_pwm1.jal
  --

Modified:  
trunk/unvalidated/sample/by_device/16f648a/sample_serial_hardware.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f648a/sample_serial_hardware.jal       
 
(original)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_serial_hardware.jal       
 
Wed Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  --    setup: a serial connection to a terminal
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:36 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:22 2008, from:
  --    * board: board_16f648a_js.jal
  --    * test : test_serial_hardware.jal
  --
@@ -40,8 +40,10 @@

  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  include delay


Modified: trunk/unvalidated/sample/by_device/16f648a/sample_serial_print.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f648a/sample_serial_print.jal   
(original)
+++ trunk/unvalidated/sample/by_device/16f648a/sample_serial_print.jal  Wed  
Dec 24 01:10:40 2008
@@ -18,7 +18,7 @@
  --        run serial tests to make sure serial comms works okay.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:34 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:17 2008, from:
  --    * board: board_16f648a_js.jal
  --    * test : test_serial_print.jal
  --
@@ -36,8 +36,10 @@

  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  include delay


Modified: trunk/unvalidated/sample/by_device/16f877a/sample_blink.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_blink.jal (original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_blink.jal Wed Dec 24  
01:10:40 2008
@@ -18,7 +18,7 @@
  --  - File creation date/time: 22 Aug 2008 13:36:27.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:38 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:25 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_blink.jal
  --
@@ -32,8 +32,10 @@
  pragma target   WDT disabled
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_a0
-var bit led_direction is pin_a0_direction
+var bit led             is pin_a0
+var bit led_direction   is pin_a0_direction
+var bit led2            is pin_a1
+var bit led2_direction  is pin_a1_direction

  enable_digital_io()
  --

Added: trunk/unvalidated/sample/by_device/16f877a/sample_i2c_sw_l1.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_i2c_sw_l1.jal     Wed Dec 
 
24 01:10:40 2008
@@ -0,0 +1,107 @@
+-- ------------------------------------------------------
+-- Title: Test program for i2c_hardware.jal
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2008, 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: Level 0 i2c test program
+--    interact with an i2c eeprom using the i2c primitives
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+--  defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+--    setup:
+--         an 24lc256 i2c eeprom, connected to the test board i2c pins.
+--         a serial connection to a terminal
+--
+-- --------------------------------------------------------
+-- This file has been generated on Wed Dec 24 10:10:34 2008, from:
+--    * board: board_16f877a_dwarf.jal
+--    * test : test_i2c_sw_l1.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 i2c
+-- I2C io definition
+var volatile bit i2c_scl            is pin_c3
+var volatile bit i2c_scl_direction  is pin_c3_direction
+var volatile bit i2c_sda            is pin_c4
+var volatile bit i2c_sda_direction  is pin_c4_direction
+
+-- generic setup (see releated examples for more details)
+const usart_hw_serial = true   -- true = RS232, false = SPI
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+include print
+include delay
+
+-- i2c setup
+const word _i2c_bus_speed = 1 ; * 100kHz
+const bit _i2c_level = true   ; i2c levels (not SMB)
+
+include i2c_software
+;include i2c_hardware
+
+i2c_initialize()
+
+
+var byte i2c_tx_buffer[10]
+var byte i2c_rx_buffer[10]
+
+include i2c_level1
+
+-- we're alive
+const byte str1[] = "Test.\r\n"
+print_string(serial_hw_data, str1)
+
+
+var bit r
+var byte i
+forever loop
+
+   -- Send 2 bytes address to device 0xA0 and then read 3 bytes of data
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 0  -- low byte address within i2c eeprom
+   r = i2c_send_receive(0xA0, 2, 3)
+
+;   -- same as above
+;   r = i2c_receive_wordaddr(0xA0, 0x0000, 3)
+
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[0]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[1]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[2]);
+   serial_hw_data = " "
+
+   -- write part (increment 3rd byte at 0x0002)
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 2  -- low byte address within i2c eeprom
+   i2c_tx_buffer[2] = i2c_rx_buffer[2] + 1  -- data
+   r = i2c_send_receive(0xA0, 3, 0)
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_crlf(serial_hw_data)
+
+   delay_100ms(10)
+end loop

Modified:  
trunk/unvalidated/sample/by_device/16f877a/sample_lcd_hd44780_4.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_lcd_hd44780_4.jal  
(original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_lcd_hd44780_4.jal Wed  
Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  -- setup: an hd44780 compatible display, used in 4-bit mode.
  --
  --  
----------------------------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:38 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:25 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_lcd_hd44780_4.jal
  --
@@ -47,8 +47,10 @@
  const byte LCD_CHARS    = 16                    -- 16 chars per line
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_a0
-var bit led_direction is pin_a0_direction
+var bit led             is pin_a0
+var bit led_direction   is pin_a0_direction
+var bit led2            is pin_a1
+var bit led2_direction  is pin_a1_direction

  enable_digital_io()


Modified: trunk/unvalidated/sample/by_device/16f877a/sample_pwm1.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_pwm1.jal  (original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_pwm1.jal  Wed Dec 24  
01:10:40 2008
@@ -17,7 +17,7 @@
  -- Notes: setup: a led on ccp1
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:40 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:31 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_pwm1.jal
  --

Modified: trunk/unvalidated/sample/by_device/16f877a/sample_pwm2.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_pwm2.jal  (original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_pwm2.jal  Wed Dec 24  
01:10:40 2008
@@ -17,7 +17,7 @@
  -- Notes: setup: a led on ccp2
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:40 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:27 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_pwm2.jal
  --

Modified:  
trunk/unvalidated/sample/by_device/16f877a/sample_serial_hardware.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_serial_hardware.jal       
 
(original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_serial_hardware.jal       
 
Wed Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  --    setup: a serial connection to a terminal
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:40 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:32 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_serial_hardware.jal
  --
@@ -36,8 +36,10 @@
  pragma target   WDT disabled
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_a0
-var bit led_direction is pin_a0_direction
+var bit led             is pin_a0
+var bit led_direction   is pin_a0_direction
+var bit led2            is pin_a1
+var bit led2_direction  is pin_a1_direction

  include delay


Modified: trunk/unvalidated/sample/by_device/16f877a/sample_serial_print.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f877a/sample_serial_print.jal   
(original)
+++ trunk/unvalidated/sample/by_device/16f877a/sample_serial_print.jal  Wed  
Dec 24 01:10:40 2008
@@ -18,7 +18,7 @@
  --        run serial tests to make sure serial comms works okay.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:39 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:26 2008, from:
  --    * board: board_16f877a_dwarf.jal
  --    * test : test_serial_print.jal
  --
@@ -32,8 +32,10 @@
  pragma target   WDT disabled
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_a0
-var bit led_direction is pin_a0_direction
+var bit led             is pin_a0
+var bit led_direction   is pin_a0_direction
+var bit led2            is pin_a1
+var bit led2_direction  is pin_a1_direction

  include delay


Modified: trunk/unvalidated/sample/by_device/16f88/sample_blink.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/sample_blink.jal   (original)
+++ trunk/unvalidated/sample/by_device/16f88/sample_blink.jal   Wed Dec 24  
01:10:40 2008
@@ -18,7 +18,7 @@
  --  - File creation date/time: 22 Aug 2008 13:36:27.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:43 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:35 2008, from:
  --    * board: board_16f88_js.jal
  --    * test : test_blink.jal
  --
@@ -26,18 +26,30 @@
  -- chip setup
  include 16f88

---
--- This program assumes a 20 MHz resonator or crystal
--- is connected to pins OSC1 and OSC2.
+;--
+;-- This setup 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       -- no watchdog
  pragma target LVP       disabled       -- no low-voltage programming
  pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  enable_digital_io()
  --

Added: trunk/unvalidated/sample/by_device/16f88/sample_i2c_sw_l1.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/by_device/16f88/sample_i2c_sw_l1.jal       Wed Dec 
 
24 01:10:40 2008
@@ -0,0 +1,125 @@
+-- ------------------------------------------------------
+-- Title: Test program for i2c_hardware.jal
+--
+-- Author: Joep Suijs, Copyright (c) 2008..2008, 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: Level 0 i2c test program
+--    interact with an i2c eeprom using the i2c primitives
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+--  defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+--    setup:
+--         an 24lc256 i2c eeprom, connected to the test board i2c pins.
+--         a serial connection to a terminal
+--
+-- --------------------------------------------------------
+-- This file has been generated on Wed Dec 24 10:10:42 2008, from:
+--    * board: board_16f88_js.jal
+--    * test : test_i2c_sw_l1.jal
+--
+;@jallib section chipdef
+-- chip setup
+include 16f88
+
+;--
+;-- This setup 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       -- no watchdog
+pragma target LVP       disabled       -- no low-voltage programming
+pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
+;@jallib section i2c
+-- I2C io definition
+var volatile bit i2c_scl            is pin_b4
+var volatile bit i2c_scl_direction  is pin_b4_direction
+
+-- b3 is pin-compatible with 16f648a board file, b1 is on hardware pins
+;var volatile bit i2c_sda            is pin_b3
+;var volatile bit i2c_sda_direction  is pin_b3_direction
+var volatile bit i2c_sda            is pin_b1
+var volatile bit i2c_sda_direction  is pin_b1_direction
+
+-- generic setup (see releated examples for more details)
+const usart_hw_serial = true   -- true = RS232, false = SPI
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+include print
+include delay
+
+-- i2c setup
+const word _i2c_bus_speed = 1 ; * 100kHz
+const bit _i2c_level = true   ; i2c levels (not SMB)
+
+include i2c_software
+;include i2c_hardware
+
+i2c_initialize()
+
+
+var byte i2c_tx_buffer[10]
+var byte i2c_rx_buffer[10]
+
+include i2c_level1
+
+-- we're alive
+const byte str1[] = "Test.\r\n"
+print_string(serial_hw_data, str1)
+
+
+var bit r
+var byte i
+forever loop
+
+   -- Send 2 bytes address to device 0xA0 and then read 3 bytes of data
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 0  -- low byte address within i2c eeprom
+   r = i2c_send_receive(0xA0, 2, 3)
+
+;   -- same as above
+;   r = i2c_receive_wordaddr(0xA0, 0x0000, 3)
+
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[0]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[1]);
+   serial_hw_data = " "
+   print_byte_hex(serial_hw_data, i2c_rx_buffer[2]);
+   serial_hw_data = " "
+
+   -- write part (increment 3rd byte at 0x0002)
+   i2c_tx_buffer[0] = 0  -- high byte address within i2c eeprom
+   i2c_tx_buffer[1] = 2  -- low byte address within i2c eeprom
+   i2c_tx_buffer[2] = i2c_rx_buffer[2] + 1  -- data
+   r = i2c_send_receive(0xA0, 3, 0)
+   print_bit_truefalse(serial_hw_data, r)
+   serial_hw_data = " "
+
+   print_crlf(serial_hw_data)
+
+   delay_100ms(10)
+end loop

Modified: trunk/unvalidated/sample/by_device/16f88/sample_lcd_hd44780_4.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/sample_lcd_hd44780_4.jal    
(original)
+++ trunk/unvalidated/sample/by_device/16f88/sample_lcd_hd44780_4.jal   Wed  
Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  -- setup: an hd44780 compatible display, used in 4-bit mode.
  --
  --  
----------------------------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:43 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:35 2008, from:
  --    * board: board_16f88_js.jal
  --    * test : test_lcd_hd44780_4.jal
  --
@@ -30,14 +30,24 @@
  -- chip setup
  include 16f88

---
--- This program assumes a 20 MHz resonator or crystal
--- is connected to pins OSC1 and OSC2.
+;--
+;-- This setup 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       -- no watchdog
  pragma target LVP       disabled       -- no low-voltage programming
  pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
  ;@jallib section lcd_hd44780_4
  -- LCD IO definition
  var bit lcd_rs           is pin_b4              -- LCD command/data select.
@@ -51,8 +61,10 @@
  const byte LCD_CHARS    = 16                    -- 16 chars per line
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  enable_digital_io()


Modified: trunk/unvalidated/sample/by_device/16f88/sample_pwm1.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/sample_pwm1.jal    (original)
+++ trunk/unvalidated/sample/by_device/16f88/sample_pwm1.jal    Wed Dec 24  
01:10:40 2008
@@ -17,7 +17,7 @@
  -- Notes: setup: a led on ccp1
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:46 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:40 2008, from:
  --    * board: board_16f88_js.jal
  --    * test : test_pwm1.jal
  --
@@ -25,14 +25,24 @@
  -- chip setup
  include 16f88

---
--- This program assumes a 20 MHz resonator or crystal
--- is connected to pins OSC1 and OSC2.
+;--
+;-- This setup 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       -- no watchdog
  pragma target LVP       disabled       -- no low-voltage programming
  pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
  ;@jallib section ccp
  -- ccp setup
  var volatile bit pin_ccp1_direction is pin_b3_direction

Modified:  
trunk/unvalidated/sample/by_device/16f88/sample_serial_hardware.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/sample_serial_hardware.jal  
(original)
+++ trunk/unvalidated/sample/by_device/16f88/sample_serial_hardware.jal Wed  
Dec 24 01:10:40 2008
@@ -22,7 +22,7 @@
  --    setup: a serial connection to a terminal
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:46 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:41 2008, from:
  --    * board: board_16f88_js.jal
  --    * test : test_serial_hardware.jal
  --
@@ -30,18 +30,30 @@
  -- chip setup
  include 16f88

---
--- This program assumes a 20 MHz resonator or crystal
--- is connected to pins OSC1 and OSC2.
+;--
+;-- This setup 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       -- no watchdog
  pragma target LVP       disabled       -- no low-voltage programming
  pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  include delay


Modified: trunk/unvalidated/sample/by_device/16f88/sample_serial_print.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/sample_serial_print.jal     
(original)
+++ trunk/unvalidated/sample/by_device/16f88/sample_serial_print.jal    Wed  
Dec 24 01:10:40 2008
@@ -18,7 +18,7 @@
  --        run serial tests to make sure serial comms works okay.
  --
  -- --------------------------------------------------------
--- This file has been generated on Sat Dec 20 13:45:45 2008, from:
+-- This file has been generated on Wed Dec 24 10:10:37 2008, from:
  --    * board: board_16f88_js.jal
  --    * test : test_serial_print.jal
  --
@@ -26,18 +26,30 @@
  -- chip setup
  include 16f88

---
--- This program assumes a 20 MHz resonator or crystal
--- is connected to pins OSC1 and OSC2.
+;--
+;-- This setup 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       -- no watchdog
  pragma target LVP       disabled       -- no low-voltage programming
  pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+
+--
+-- This setup uses the internal oscillator
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+
  ;@jallib section led
  -- LED IO definition
-var bit led           is pin_b3
-var bit led_direction is pin_b3_direction
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction

  include delay


Modified: trunk/unvalidated/sample/test/board/board_16f88_js.jal
==============================================================================
--- trunk/unvalidated/sample/test/board/board_16f88_js.jal      (original)
+++ trunk/unvalidated/sample/test/board/board_16f88_js.jal      Wed Dec 24  
01:10:40 2008
@@ -46,20 +46,20 @@
  ;--
  ;-- This setup 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       -- no watchdog
-;pragma target LVP       disabled       -- no low-voltage programming
-;pragma target CCP1MUX   RB3            -- ccp1 pin on B3
+pragma target OSC       HS             -- HS crystal or resonator
+pragma target clock     20_000_000     -- oscillator frequency
+pragma target WDT       disabled       -- no watchdog
+pragma target LVP       disabled       -- no low-voltage programming
+pragma target CCP1MUX   RB3            -- ccp1 pin on B3

  --
  -- This setup uses the internal oscillator
-pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
-pragma target clock     8_000_000         -- oscillator frequency
-pragma target WDT       disabled          -- no watchdog
-pragma target LVP       disabled          -- no low-voltage programming
-pragma target CCP1MUX   RB3               -- ccp1 pin on B3
-OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)
+;pragma target OSC       INTOSC_NOCLKOUT   -- HS crystal or resonator
+;pragma target clock     8_000_000         -- oscillator frequency
+;pragma target WDT       disabled          -- no watchdog
+;pragma target LVP       disabled          -- no low-voltage programming
+;pragma target CCP1MUX   RB3               -- ccp1 pin on B3
+;OSCCON_IRCF = 7                           -- set prescaler to 1 (8 MHz)


  ;@jallib section led

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