Revision: 1125
Author: jsuijs
Date: Sun Jul 26 14:59:56 2009
Log: keyboard sample file
http://code.google.com/p/jallib/source/detail?r=1125

Added:
  /trunk/sample/16f877a_keyboard.jal

=======================================
--- /dev/null
+++ /trunk/sample/16f877a_keyboard.jal  Sun Jul 26 14:59:56 2009
@@ -0,0 +1,78 @@
+-- ------------------------------------------------------
+-- Title: Test program for keyboar
+--
+-- 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: Testing keyboard (4x4, 3x4)
+-- --
+-- This file defines a test for JALLIB testing, using a test-board
+--  defined by a BOARD file .
+--
+-- Sources:
+--
+-- Notes:
+-- setup:   A keyboard 4x3 or 4x4 connected to two half ports
+--
+-- ------------------------------------------------------
+--
+-- This file has been generated from:
+--    * board: board_16f877a_dwarf.jal
+--    * test : test_keyboard.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
+
+include delay
+enable_digital_io()
+
+-- setup serial (see echo.jal for more details);@jallib section serial
+const serial_hw_baudrate = 115_200
+include serial_hardware
+serial_hw_init()
+
+include print
+;@jallib section keyboard
+-- setup the two half ports
+-- (rows and cols on separte ports - unlikely setup for dwarf-board)
+var volatile byte keyscan  is porta_low      -- rows of keyboard
+var volatile byte keydrive is portb_low      -- columns of keyboard
+var volatile byte keydrive_direction is portb_low_direction
+include keyboard                             -- check for schematics
+
+-- -------------------------- PROGRAM START----------------------------
+const byte str1[] = " - Test keyboard.jal- bytes\r\n"   -- define a string
+print_string(serial_hw_data, str1)                 -- output string
+
+var byte key
+
+forever loop
+   key = getkey()
+   print_byte_dec(serial_hw_data,  key)
+
+   serial_hw_data = " "
+
+   key = getkey_once()
+   print_byte_dec(serial_hw_data,  key)
+
+   print_crlf(serial_hw_data)
+   delay_100ms(2)
+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