Revision: 1649
Author: robhamerling
Date: Tue Feb 2 00:18:42 2010
Log: Added two samples of serial_hw_int_cts library with PICs with 2 USARTs
http://code.google.com/p/jallib/source/detail?r=1649
Added:
/trunk/sample/18f6310_serial_hw_int_cts.jal
/trunk/sample/18f6520_serial_hw_int_cts.jal
=======================================
--- /dev/null
+++ /trunk/sample/18f6310_serial_hw_int_cts.jal Tue Feb 2 00:18:42 2010
@@ -0,0 +1,72 @@
+-- ------------------------------------------------------
+-- Title: Test program for serial_hw_int_cts.jal for 18F6310
+--
+-- Author: Rob Hamerling, Copyright (c) 2009..2010, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: 2.4m
+--
+-- 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 serial hardware lib using interrupts
+-- and CTS output flow control
+-- Echoes all incoming data.
+--
+-- Sources:
+--
+-- Notes:
+-- The 18f6310 has two USARTs, of which the first is used.
+--
+--
+-- ------------------------------------------------------
+
+-- chip setup
+include 18f6310
+
+pragma target clock 20_000_000 -- osc frequency
+
+pragma target OSC HS
+pragma target FCMEN disabled
+pragma target IESO disabled
+pragma target PWRTE enabled
+pragma target BROWNOUT disabled
+pragma target WDT disabled
+pragma target MCLR external
+pragma target XINST disabled
+pragma target DEBUG disabled
+
+include delay
+
+-- set all IO as digital
+enable_digital_io()
+
+
+-- setup USART
+const serial_hw_baudrate = 115_200
+alias serial_ctsinv is pin_A4 -- incoming data flow control
+alias serial_rtsinv is pin_C1 -- outgoing data flow control
+pin_A4_direction = OUTPUT
+pin_C1_direction = INPUT
+var bit serial_overflow_discard = false -- no transmit buffer overflow
+
+include serial_hw_int_cts
+
+serial_hw_init()
+
+include print -- formatting routines
+
+const byte str[] = "PIC"
+
+print_string(serial_hw_data, str)
+print_string(serial_hw_data, PICTYPE)
+serial_hw_data = " "
+
+var byte char
+forever loop
+ if (serial_hw_read(char) == true) then
+ serial_hw_write(char)
+ end if
+end loop
+
=======================================
--- /dev/null
+++ /trunk/sample/18f6520_serial_hw_int_cts.jal Tue Feb 2 00:18:42 2010
@@ -0,0 +1,67 @@
+-- ------------------------------------------------------
+-- Title: Test program for serial_hw_int_cts.jal for 18F6620
+--
+-- Author: Rob Hamerling, Copyright (c) 2009..2010, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: 2.4m
+--
+-- 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 serial hardware lib using interrupts
+-- and CTS output flow control
+-- Echoes all incoming data.
+--
+-- Sources:
+--
+-- Notes:
+-- The 18f6520 has two USARTs, of which the first is used.
+--
+-- ------------------------------------------------------
+
+-- chip setup
+include 18f6520
+
+pragma target clock 20_000_000 -- osc frequency
+
+pragma target OSC HS
+pragma target PWRTE enabled
+pragma target BROWNOUT disabled
+pragma target WDT disabled
+pragma target DEBUG disabled
+
+include delay
+
+-- set all IO as digital
+enable_digital_io()
+
+
+-- setup USART
+const serial_hw_baudrate = 115_200
+alias serial_ctsinv is pin_A4 -- incoming data flow control
+alias serial_rtsinv is pin_C1 -- outgoing data flow control
+pin_A4_direction = OUTPUT
+pin_C1_direction = INPUT
+var bit serial_overflow_discard = false -- no transmit buffer overflow
+
+include serial_hw_int_cts
+
+serial_hw_init()
+
+include print -- formatting routines
+
+const byte str[] = "PIC"
+
+print_string(serial_hw_data, str)
+print_string(serial_hw_data, PICTYPE)
+serial_hw_data = " "
+
+var byte char
+forever loop
+ if (serial_hw_read(char) == true) then
+ serial_hw_write(char)
+ 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.