Author: jsuijs
Date: Sat Oct 25 13:46:47 2008
New Revision: 474
Added:
trunk/unvalidated/sample/test/jal/test_serial_print.jal
Modified:
trunk/unvalidated/sample/test/jal/test_serial_format.jal
trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_hw_l0.jal
trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_sw_l0.jal
trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal
trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal
trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
Log:
testfile are now jsg compliant (added header)
Modified: trunk/unvalidated/sample/test/jal/test_serial_format.jal
==============================================================================
--- trunk/unvalidated/sample/test/jal/test_serial_format.jal (original)
+++ trunk/unvalidated/sample/test/jal/test_serial_format.jal Sat Oct 25
13:46:47 2008
@@ -1,3 +1,23 @@
+-- ------------------------------------------------------
+-- Title: Test program for format.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: Test program
+--
+-- Sources:
+--
+-- Notes: as output, this sample produces characters on a serial link.
First
+-- run serial tests to make sure serial comms works okay.
+--
+-- ------------------------------------------------------
include delay
-- set all IO as digital
Added: trunk/unvalidated/sample/test/jal/test_serial_print.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/test/jal/test_serial_print.jal Sat Oct 25
13:46:47 2008
@@ -0,0 +1,187 @@
+-- ------------------------------------------------------
+-- Title: Test program for print.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: Test program
+--
+-- Sources:
+--
+-- Notes: as output, this sample produces characters on a serial link.
First
+-- run serial tests to make sure serial comms works okay.
+--
+-- ------------------------------------------------------
+
+include delay
+
+-- set all IO as digital
+enable_digital_io()
+
+
+-- setup serial (see echo.jal 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 format
+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 = -8388609
+; 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
+
+
+
+-- A - Test print.jal- bytes
+-- 210
+-- D2
+-- 11010010
+-- -109
+-- Test print.jal - words
+-- 45678
+-- B26E
+-- 1011001001101110
+-- -32109
+-- Test print.jal - dwords
+-- 3210987654
+-- BF63C886
+-- 10111111011000111100100010000110
+-- -2109876543
+-- Test print.jal - bit
+-- 1 high true 0 low false
+-- Variable x has decimal value 121 which is hex value 79 and represents
ASCII character y
+
Modified: trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_hw_l0.jal
==============================================================================
--- trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_hw_l0.jal
(original)
+++ trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_hw_l0.jal Sat Oct
25 13:46:47 2008
@@ -1,14 +1,29 @@
---
--------------------------------------------------------------------------
--- Level 0 i2c TEST file: interact with an i2c eeprom using the i2c
primitives
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
+-- 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 .
--
--- setup: an 24lc256 i2c eeprom, connected to the test board i2c pins.
+-- Sources:
+--
+-- Notes:
+-- setup:
+-- an 24lc256 i2c eeprom, connected to the test board i2c pins.
+-- a serial connection to a terminal
--
---
--------------------------------------------------------------------------
---
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
-- generic setup (see releated examples for more details)
const usart_hw_serial = true -- true = RS232, false = SPI
Modified: trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_sw_l0.jal
==============================================================================
--- trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_sw_l0.jal
(original)
+++ trunk/unvalidated/sample/test/peripheral/i2c/test_i2c_sw_l0.jal Sat Oct
25 13:46:47 2008
@@ -1,14 +1,29 @@
---
--------------------------------------------------------------------------
--- Level 0 i2c TEST file: interact with an i2c eeprom using the i2c
primitives
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
+-- Title: Test program for i2c_software.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 .
--
--- setup: an 24lc256 i2c eeprom, connected to the test board i2c pins.
+-- Sources:
+--
+-- Notes:
+-- setup:
+-- an 24lc256 i2c eeprom, connected to the test board i2c pins.
+-- a serial connection to a terminal
--
---
--------------------------------------------------------------------------
---
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
-- generic setup (see releated examples for more details)
const usart_hw_serial = true -- true = RS232, false = SPI
@@ -22,7 +37,7 @@
const word _i2c_bus_speed = 1 ; * 100kHz
const bit _i2c_level = true ; i2c levels (not SMB)
-;include i2c_software
+;include i2c_software
include i2c_software
i2c_initialize()
Modified: trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal
==============================================================================
--- trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal (original)
+++ trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal Sat Oct 25
13:46:47 2008
@@ -1,14 +1,22 @@
---
--------------------------------------------------------------------------
--- pwm1 TEST file
---
--------------------------------------------------------------------------
--- This file defines a test for JALLIB testing, using a test-board
--- defined by a BOARD file .
---
--- setup: a led on ccp2
---
---
--------------------------------------------------------------------------
---
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
+-- Title: Test program for pwm1.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: Test program
+--
+-- Sources:
+--
+-- Notes: setup: a led on ccp1
+--
+-- ------------------------------------------------------
enable_digital_io()
-- Configure PWM
Modified: trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal
==============================================================================
--- trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal (original)
+++ trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal Sat Oct 25
13:46:47 2008
@@ -1,14 +1,22 @@
---
--------------------------------------------------------------------------
--- pwm2 TEST file
---
--------------------------------------------------------------------------
--- This file defines a test for JALLIB testing, using a test-board
--- defined by a BOARD file .
---
--- setup: a led on ccp2
---
---
--------------------------------------------------------------------------
---
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
+-- Title: Test program for pwm2.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: Test program
+--
+-- Sources:
+--
+-- Notes: setup: a led on ccp2
+--
+-- ------------------------------------------------------
enable_digital_io()
Modified:
trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
==============================================================================
--- trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
(original)
+++ trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
Sat Oct 25 13:46:47 2008
@@ -1,16 +1,27 @@
---
--------------------------------------------------------------------------
--- serial_hardware TEST file
---
--------------------------------------------------------------------------
+-- ------------------------------------------------------
+-- Title: Test program for serial_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 .
--
--- setup: a serial connection to a terminal
+-- Sources:
+--
+-- Notes:
+-- setup: a serial connection to a terminal
--
---
--------------------------------------------------------------------------
---
---
--------------------------------------------------------------------------
-
-
+-- ------------------------------------------------------
include delay
-- set all IO as digital
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---