Revision: 1809
Author: wattymage
Date: Tue Mar 16 01:14:50 2010
Log: Added print_sword_fp
http://code.google.com/p/jallib/source/detail?r=1809

Modified:
 /trunk/include/jal/print.jal

=======================================
--- /trunk/include/jal/print.jal        Thu Aug 20 14:43:34 2009
+++ /trunk/include/jal/print.jal        Tue Mar 16 01:14:50 2010
@@ -1,6 +1,6 @@
 -- Title: Writes variables to output device
 -- Author: Joep Suijs, Copyright (c) 2007..2008, all rights reserved.
--- Adapted-by: Joep Suijs
+-- Adapted-by: Joep Suijs, Michael Watterson
 -- Compiler: >=2.2
 --
 -- This file is part of jallib (http://jallib.googlecode.com)
@@ -23,7 +23,8 @@
 -- print_sword_dec(Serial_HW_data, BHL)
 --
 -- Notes:
---
+--  print_sword_fp_dec uses "fixed point" integer, -127.256 to +127.256
+--  Imagine the decimal. Thus 0x110 = 1.5 as 128 = 0.5 and 256 = 1

 include jascii

@@ -188,6 +189,14 @@

 end procedure

+-- 8 bit fixed point integer math
+procedure print_sword_fp_dec(volatile byte out device, sword in data) is
+
+   _print_suniversal_dec(device, (data >> 8), 10000, 5) -- whole part
+   device = "."
+   _print_suniversal_dec(device, (data & 0xFF), 10000, 5) -- decimal part
+end procedure
+
 procedure print_sbyte_dec(volatile byte out device, sbyte in data) is

    _print_suniversal_dec(device, data, 100, 3)

--
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