Author: jsuijs
Date: Sat Oct 11 10:56:36 2008
New Revision: 387
Added:
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
Modified:
trunk/unvalidated/sample/by_device/16f88/pwm_led.jal
trunk/unvalidated/sample/test/board/board_16f648a_js.jal
trunk/unvalidated/sample/test/board/board_16f877a_dwarf.jal
Log:
Modified: trunk/unvalidated/sample/by_device/16f88/pwm_led.jal
==============================================================================
--- trunk/unvalidated/sample/by_device/16f88/pwm_led.jal (original)
+++ trunk/unvalidated/sample/by_device/16f88/pwm_led.jal Sat Oct 11
10:56:36 2008
@@ -36,13 +36,13 @@
-- loop up and down, to produce different duty cycle
while i < 250 loop
pwm1_set_dutycycle(i)
- _usec_delay(100000)
- i = i + 10
+ _usec_delay(10000)
+ i = i + 1
end loop
while i > 0 loop
pwm1_set_dutycycle(i)
- _usec_delay(100000)
- i = i - 10
+ _usec_delay(10000)
+ i = i - 1
end loop
-- turning off, the LED lights at max.
_usec_delay(500000)
Modified: trunk/unvalidated/sample/test/board/board_16f648a_js.jal
==============================================================================
--- trunk/unvalidated/sample/test/board/board_16f648a_js.jal (original)
+++ trunk/unvalidated/sample/test/board/board_16f648a_js.jal Sat Oct 11
10:56:36 2008
@@ -55,8 +55,14 @@
var byte lcd_dataport is porta_low -- LCD data port
var byte lcd_dataport_direction is porta_low_direction -- LCD data port
+const byte LCD_ROWS = 2 -- 2 lines
+const byte LCD_CHARS = 16 -- 16 chars per line
+-- I2C setup
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
+
+-- ccp setup
+var volatile bit pin_ccp1_direction is pin_b3_direction
Modified: trunk/unvalidated/sample/test/board/board_16f877a_dwarf.jal
==============================================================================
--- trunk/unvalidated/sample/test/board/board_16f877a_dwarf.jal (original)
+++ trunk/unvalidated/sample/test/board/board_16f877a_dwarf.jal Sat Oct 11
10:56:36 2008
@@ -36,8 +36,15 @@
var byte lcd_dataport is portb_low -- LCD data port
var byte lcd_dataport_direction is portb_low_direction -- LCD data port
+const byte LCD_ROWS = 2 -- 2 lines
+const byte LCD_CHARS = 16 -- 16 chars per line
+-- I2C setup
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
+
+-- ccp setup
+var volatile bit pin_ccp1_direction is pin_c2_direction
+var volatile bit pin_ccp2_direction is pin_c1_direction
\ No newline at end of file
Added: trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/test/peripheral/pwm/test_pwm1.jal Sat Oct 11
10:56:36 2008
@@ -0,0 +1,41 @@
+--
--------------------------------------------------------------------------
+-- 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
+--
+--
--------------------------------------------------------------------------
+--
+--
--------------------------------------------------------------------------
+enable_digital_io()
+
+-- Configure PWM
+pin_ccp1_direction = output
+include pwm_ccp1
+pwm_max_resolution(1)
+pwm1_on()
+
+forever loop
+ var byte i
+ i = 0
+ -- loop up and down, to produce different duty cycle
+ while i < 250 loop
+ pwm1_set_dutycycle(i)
+ _usec_delay(10000)
+ i = i + 1
+ end loop
+ while i > 0 loop
+ pwm1_set_dutycycle(i)
+ _usec_delay(10000)
+ i = i - 1
+ end loop
+ -- turning off, the LED lights at max.
+ _usec_delay(500000)
+ pwm1_off()
+ _usec_delay(500000)
+ pwm1_on()
+
+end loop
+
Added: trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/test/peripheral/pwm/test_pwm2.jal Sat Oct 11
10:56:36 2008
@@ -0,0 +1,42 @@
+--
--------------------------------------------------------------------------
+-- 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
+--
+--
--------------------------------------------------------------------------
+--
+--
--------------------------------------------------------------------------
+
+enable_digital_io()
+
+-- Configure PWM
+pin_ccp2_direction = output
+include pwm_ccp2
+pwm_max_resolution(1)
+pwm2_on()
+
+forever loop
+ var byte i
+ i = 0
+ -- loop up and down, to produce different duty cycle
+ while i < 250 loop
+ pwm2_set_dutycycle(i)
+ _usec_delay(10000)
+ i = i + 1
+ end loop
+ while i > 0 loop
+ pwm2_set_dutycycle(i)
+ _usec_delay(10000)
+ i = i - 1
+ end loop
+ -- turning off, the LED lights at max.
+ _usec_delay(500000)
+ pwm2_off()
+ _usec_delay(500000)
+ pwm2_on()
+
+end loop
+
Added:
trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/test/peripheral/usart/test_serial_hardware.jal
Sat Oct 11 10:56:36 2008
@@ -0,0 +1,57 @@
+--
--------------------------------------------------------------------------
+-- serial_hardware TEST file
+--
--------------------------------------------------------------------------
+-- This file defines a test for JALLIB testing, using a test-board
+-- defined by a BOARD file .
+--
+-- setup: a serial connection to a terminal
+--
+--
--------------------------------------------------------------------------
+--
+--
--------------------------------------------------------------------------
+
+
+include delay_any_mc
+
+-- set all IO as digital
+enable_digital_io()
+
+-- ok, now setup serial
+const usart_hw_serial = true -- true = RS232, false = SPI
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+
+include print -- output library
+
+led_direction = output
+for 4 loop
+ LED = on
+; delay_100ms(3)
+ LED = off
+; delay_100ms(3)
+end loop
+
+
+
+const byte str1[] = "Hello serial world" -- define a string
+print_string(serial_hw_data, str1) -- output string to LCD
+
+-- inform user PIC is ready !
+serial_hw_write("!")
+
+-- let's build our loop
+var byte char -- will store received char
+var word counter = 10
+forever loop
+ if serial_hw_read(char) then
+ serial_hw_write(char) -- that's the echo...
+ end if
+
+ counter = counter - 1;
+ if (counter == 0) then
+ counter = 50000
+ serial_hw_data = "."
+ LED = ! LED
+ end if
+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
-~----------~----~----~----~------~----~------~--~---