Author: robhamerling
Date: Mon Oct  6 02:08:07 2008
New Revision: 352

Added:
    trunk/unvalidated/sample/test/peripheral/usart/echo.jal

Log:

Test/sample program for 'serial_hw_int_cts.jal'



Added: trunk/unvalidated/sample/test/peripheral/usart/echo.jal
==============================================================================
--- (empty file)
+++ trunk/unvalidated/sample/test/peripheral/usart/echo.jal     Mon Oct  6  
02:08:07 2008
@@ -0,0 +1,80 @@
+-- =======================================================================
+-- Title: Test program for serial_hw_int_cts library.
+--
+-- Author: Rob Hamerling, Copyright (c) 2008..2008, all rights reserved.
+--
+-- Adapted-by:
+--
+-- Compiler: =2.4h
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: Program to test the serial_hw_int_cts library.
+--                - Echo incoming byte multiple times to check
+--                  transmit buffer overflow handling.
+--                - The host program may use a hardware FiFo buffer
+--                  (standard in most serial PC ports) to test
+--                  CTS flow control and receive buffer overflow.
+--
+-- Sources:
+--
+-- Dependencies:  serial_hw_int_cts.jal       (RS232 library)
+--
+-- Notes: - With a serial port monitor data loss and the working of
+--          of data flow control can be checked.
+--
+-- -----------------------------------------------------------------------
+
+include 16F88                                   -- target: PIC16F88
+
+pragma target clock 16_000_000                  -- resonator frequency
+
+pragma  bootloader long_start                   -- for TinyBootloader
+
+pragma target OSC        hs
+pragma target WDT        disabled
+pragma target PWRTE      enabled
+pragma target MCLR       external
+pragma target BROWNOUT   enabled
+pragma target LVP        disabled
+pragma target CPD        disabled
+pragma target WRT_ENABLE write_protect_off
+pragma target BACKBUG    disabled
+pragma target CCP1MUX    RB0
+pragma target CP         disabled
+pragma target IESO       disabled
+pragma target FCMEN      disabled
+
+enable_digital_io()                           -- disable analog functions
+
+-- ------- serial communications specifications --------------------------
+
+const   SERIAL_XMTBUFSIZE  = 24             -- size of transmit buffer
+const   SERIAL_RCVBUFSIZE  = 48             -- size of receive buffer
+const   SERIAL_DELTA       = 17             -- spare rcv buffer space
+
+const   SERIAL_BPSRATE     = 57600          -- host communications
+
+var  bit  serial_overflow_discard = FALSE   -- do not discard output!
+
+var  bit  serial_ctsinv            is pin_B4  -- incoming flow ctl
+var  bit  serial_ctsinv_direction  is pin_B4_direction
+
+include serial_hw_int_cts                   -- RS232 library
+
+-- ------- ----------------------------------------------------------------
+
+var   byte  x
+
+forever loop
+
+   if (serial_receive_byte(x) == true) then     -- byte available
+      for SERIAL_XMTBUFSIZE + 10 loop           -- more than xmt buffer!
+        x = serial_send_byte(x)                 -- echo many 'x'
+      end loop
+   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
-~----------~----~----~----~------~----~------~--~---

Reply via email to