Author: jsuijs
Date: Sat Apr 25 01:55:48 2009
New Revision: 941
Added:
trunk/include/jal/print_ng.jal
Modified:
trunk/include/jal/print.jal
Log:
moved new print version to print_ng.jal since it breaks all current code.
Modified: trunk/include/jal/print.jal
==============================================================================
--- trunk/include/jal/print.jal (original)
+++ trunk/include/jal/print.jal Sat Apr 25 01:55:48 2009
@@ -1,7 +1,6 @@
-- Title: Writes variables to output device
--- Author: Joep Suijs and Stef Mientki, Copyright (c) 2007..2008, all
rights reserved.
--- Adapted-by: Joep Suijs, Richard Zengerink
---
+-- Author: Joep Suijs, Copyright (c) 2007..2008, all rights reserved.
+-- Adapted-by: Joep Suijs
-- Compiler: >=2.2
--
-- This file is part of jallib (http://jallib.googlecode.com)
@@ -25,47 +24,21 @@
--
-- Notes:
--
-
+
+include jascii
+
; prototypes
-
+procedure _print_universal_dec(volatile byte out device, dword in data,
sdword in digit_divisor, byte in digit_number)
+procedure _print_suniversal_dec(volatile byte out device, sdword in data,
sdword in digit_divisor, byte in digit_number)
procedure print_byte_binary(volatile byte out device, byte in data)
-procedure _print_universal_dec (volatile byte out device, dword in data,
byte in digit_number, byte in decp)
-procedure _print_suniversal_dec (volatile byte out device, sdword in data,
byte in digit_number, byte in decp)
const byte nibble2hex[] = "0123456789ABCDEF" -- conversion string
-
---
-----------------------------------------------------------------------------
--- global vars
---
-----------------------------------------------------------------------------
-
-var bit _print_signed
-var bit _print_overflow
-
---
-----------------------------------------------------------------------------
---
-----------------------------------------------------------------------------
---procedure _write_digit(volatile byte out device, byte in digit, bit in
point) is
-
--- _format_digit = digit
--- if point then
--- _write_real_digit(device)
--- device = "."
--- else
- -- if _format_digit == 0 then device = _format_leader
- -- else _write_real_digit(device)
- -- end if
- -- end if
-
---end procedure
---
-----------------------------------------------------------------------------
-
-
-
-
+var bit print_prefix = false
procedure print_crlf(volatile byte out device) is
- device = 13 -- ASCII CR (cariage return)
- device = 10 -- ASCII LF (line feed)
+ device = ASCII_CR -- cariage return
+ device = ASCII_LF -- line feed
end procedure
procedure print_string(volatile byte out device, byte in str[]) is
@@ -116,6 +89,11 @@
procedure print_dword_binary(volatile byte out device, dword in data) is
+ if (print_prefix) then
+ device = "0"
+ device = "b"
+ end if
+
print_byte_binary(device, byte(data>>24))
print_byte_binary(device, byte(data>>16))
print_byte_binary(device, byte(data>>8))
@@ -124,6 +102,11 @@
end procedure
procedure print_word_binary(volatile byte out device, word in data) is
+
+ if (print_prefix) then
+ device = "0"
+ device = "b"
+ end if
print_byte_binary(device, byte(data>>8))
print_byte_binary(device, byte(data))
@@ -132,7 +115,12 @@
procedure print_byte_binary(volatile byte out device, byte in data) is
- for 8 loop
+ if (print_prefix) then
+ device = "0"
+ device = "b"
+ end if
+
+ for 8 loop
if ((data & 0x80) != 0) then
device = "1"
else
@@ -145,7 +133,12 @@
end procedure
procedure print_dword_hex(volatile byte out device, dword in data) is
-
+
+ if (print_prefix) then
+ device = "0"
+ device = "x"
+ end if
+
device = nibble2hex[0x0F & (data>>28)]
device = nibble2hex[0x0F & (data>>24)]
device = nibble2hex[0x0F & (data>>20)]
@@ -158,6 +151,11 @@
end procedure
procedure print_word_hex(volatile byte out device, word in data) is
+
+ if (print_prefix) then
+ device = "0"
+ device = "x"
+ end if
device = nibble2hex[0x0F & (data>>12)]
device = nibble2hex[0x0F & (data>>8)]
@@ -166,309 +164,89 @@
end procedure
-procedure print_byte_hex(volatile byte out device, byte in data) is
+procedure print_byte_hex(volatile byte out device, byte in data) is
+
+ if (print_prefix) then
+ device = "0"
+ device = "x"
+ end if
device = nibble2hex[0x0F & (data>>4)]
device = nibble2hex[0x0F & (data)]
end procedure
-procedure print_sdword_dec(volatile byte out device, sdword in data, byte
in digit_number, byte in decp) is
+procedure print_sdword_dec(volatile byte out device, sdword in data) is
- _print_suniversal_dec (device, data, digit_number, decp)
+ _print_suniversal_dec(device, data, 1000000000, 10)
end procedure
-procedure print_sword_dec(volatile byte out device, sword in data, byte in
digit_number, byte in decp) is
+procedure print_sword_dec(volatile byte out device, sword in data) is
- _print_suniversal_dec (device, data, digit_number, decp)
+ _print_suniversal_dec(device, data, 10000, 5)
end procedure
-procedure print_sbyte_dec(volatile byte out device, sbyte in data, byte in
digit_number, byte in decp) is
+procedure print_sbyte_dec(volatile byte out device, sbyte in data) is
- _print_suniversal_dec (device, data, digit_number, decp)
+ _print_suniversal_dec(device, data, 100, 3)
end procedure
-procedure print_dword_dec(volatile byte out device, dword in data, byte in
digit_number, byte in decp) is
-
- _print_universal_dec (device, data, digit_number, decp)
-
-end procedure
-
+procedure print_dword_dec(volatile byte out device, dword in data) is
-procedure print_word_dec(volatile byte out device, word in data, byte in
digit_number, byte in decp) is
-
- _print_universal_dec (device, data, digit_number, decp)
+ _print_universal_dec(device, data, 1000000000, 10)
end procedure
+procedure print_word_dec(volatile byte out device, word in data) is
-procedure print_byte_dec(volatile byte out device, byte in data, byte in
digit_number, byte in decp) is
+ _print_universal_dec(device, data, 10000, 5)
- _print_universal_dec (device, data, digit_number, decp)
-
end procedure
---
----------------------------------------------------------------------------
-procedure _print_suniversal_dec(volatile byte out device, sdword in data,
byte in digit_number, byte in decp) is
-
- _print_signed = false
-
- if (data < 0) then
- data = -data
- _print_signed = true
- digit_number = digit_number - 1
- end if
+procedure print_byte_dec(volatile byte out device, byte in data) is
- _print_universal_dec (device, data, digit_number, decp)
+ _print_universal_dec(device, data, 100, 3)
end procedure
---
----------------------------------------------------------------------------
-
-procedure _print_universal_dec(volatile byte out device, dword in data,
byte in digit_number, byte in decp) is
- var dword max_value = 1
- var dword max_value_dp = 1
- var byte digit
- var byte maxdigit = 0
-
- var bit no_digits_printed_yet = true;
- var bit dp_set = false
-
-
- _print_overflow = false
- maxdigit = digit_number
-
-
- if (decp != 0) then
- digit_number = digit_number - 1
- else
- dp_set = true
- end if
-
- for digit_number loop
- max_value = max_value * 10
- end loop
-
- if data >= max_value then
- _print_overflow = true
- end if
-
- if digit_number == 0 then
- _print_overflow = true
- maxdigit = 1
- end if
-
- if _print_overflow | (decp > maxdigit) then
- for maxdigit loop
- device = "#"
- end loop
- return
- end if
-
- if _print_signed then
- device = "-"
- _print_signed = false
- end if
-
- if (data == 0) then
- device = "0"
- for ( digit_number - 1) loop
- device = " "
- end loop
- return
- end if
-
- for decp loop
- max_value_dp = max_value_dp * 10
- end loop
-
- if data < max_value_dp then
- device = "0"
- no_digits_printed_yet = false
- end if
-
- while (max_value > 0) loop
- if decp == digit_number & !dp_set then
- device = "."
- dp_set = true
-
- else
- digit = byte ( data / max_value )
- data = data % max_value
- max_value = max_value / 10
- if ((digit != 0) | (no_digits_printed_yet ==
false)) then
- device = digit | "0"
- no_digits_printed_yet = false
- digit_number = digit_number - 1
- end if
- end if
- end loop
-
- if digit_number > 0 then
- for digit_number loop
- device = " "
- end loop
- end if
-end procedure
-
-
---
-----------------------------------------------------------------------------
--- Displays a date in DD[seperator]MM[seperator]YY if YEAR < 99 and
day_mounth_notation = true
--- or DD[seperator]MM[seperator]YYYY if YEAR > 99 and day_mounth_notation
= true
--- or switches DD and MM if day_mounth_notation = false
---
-----------------------------------------------------------------------------
-procedure print_date( volatile byte out device, byte in day, byte in
mounth, word in year, byte in seperator, bit in day_mounth_notation ) is
- var byte day_digit0 = 0 ;l
- var byte day_digit1 = 0 ;10
- var byte mounth_digit0 = 0 ;1
- var byte mounth_digit1 = 0 ;10
- var word year_digit0 = 0 ;1
- var byte year_digit1 = 0 ;10
- var byte year_digit2 = 0 ;100
- var byte year_digit3 = 0 ;1000
- var word year_mem = year
-
-
- while day >= 10 loop
- day_digit1 = day_digit1 + 1
- day = day - 10
- end loop
- day_digit0 = day + 48
- day_digit1 = day_digit1 + 48
- while mounth >= 10 loop
- mounth_digit1 = mounth_digit1 + 1
- mounth = mounth - 10
- end loop
- mounth_digit0 = mounth +48
- mounth_digit1 = mounth_digit1 + 48
-
-
-
- while year >= 1000 loop
- year_digit3 = year_digit3 + 1
- year = year - 1000
- end loop
-
- while year >= 100 loop
- year_digit2 = year_digit2 + 1
- year = year - 100
- end loop
-
- while year >= 10 loop
- year_digit1 = year_digit1 + 1
- year = year - 10
- end loop
- year_digit3 = year_digit3 + 48
- year_digit2 = year_digit2 + 48
- year_digit1 = year_digit1 + 48
- year_digit0 = year + 48
-
-
- if !day_mounth_notation then
- device = mounth_digit1
- device = mounth_digit0
- device = seperator
- device = day_digit1
- device = day_digit0
- device = seperator
- else
- device = day_digit1
- device = day_digit0
- device = seperator
- device = mounth_digit1
- device = mounth_digit0
- device = seperator
- end if
-
- if year_mem > 99 then
- device = year_digit3
- device = year_digit2
- else
- device = "'"
+procedure _print_suniversal_dec(volatile byte out device, sdword in data,
sdword in digit_divisor, byte in digit_number) is
+
+ if (data < 0) then
+ data = -data
+ device = "-"
end if
- device = year_digit1
- device = year_digit0
-
-end procedure
---
----------------------------------------------------------------------------
-
-
---
-----------------------------------------------------------------------------
--- Displays a time in HH:MM notation at specified position
--- Hours and minutes are specified separate
---
-----------------------------------------------------------------------------
-procedure print_time_hm(volatile byte out device,byte in HH, byte in MM) is
- var byte D10
-
- D10 = HH / 10
- HH = HH % 10
-
- -- always dsiplay Zeroes
- device = "0" + D10
- device = "0" + HH
- device = ":"
-
- D10 = MM / 10
- MM = MM % 10
-
- device = "0" + D10
- device = "0" + MM
-end procedure
---
-----------------------------------------------------------------------------
-
---
-----------------------------------------------------------------------------
--- Displays a time in HH:MM:SS notation at specified position
--- Hours and minutes and secounds are specified separate
---
-----------------------------------------------------------------------------
-procedure print_time_hms(volatile byte out device,byte in HH, byte in MM,
byte in SS) is
- var byte D10
-
- D10 = HH / 10
- HH = HH % 10
-
- -- always display Zeroes
- device = "0" + D10
- device = "0" + HH
- device = ":"
-
- D10 = MM / 10
- MM = MM % 10
-
- device = "0" + D10
- device = "0" + MM
- device = ":"
-
- D10 = SS / 10
- SS = SS % 10
-
- device = "0" + D10
- device = "0" + SS
+ _print_universal_dec(device, data, digit_divisor, digit_number)
+
end procedure
---
-----------------------------------------------------------------------------
-
---
-----------------------------------------------------------------------------
--- Displays a time in HH:MM notation at specified position
--- the input is specified in minutes
---
-----------------------------------------------------------------------------
-procedure print_time_hm_word(volatile byte out device,word in minutes) is
- var byte D10
- var byte HH
- var byte MM
- HH = byte(minutes / 60)
- MM = byte(minutes % 60)
- HH = HH % 24
+procedure _print_universal_dec(volatile byte out device, dword in data,
sdword in digit_divisor, byte in digit_number) is
+ var byte digit
+ var bit no_digits_printed_yet;
+
+ if (data == 0) then
+ device = "0"
+ return
+ end if
- print_time_hm(device, HH, MM)
+ no_digits_printed_yet = true
+ while (digit_divisor > 0) loop
+ digit = byte ( data / digit_divisor )
+ data = data % digit_divisor
+ digit_divisor = digit_divisor / 10
+
+ if ((digit != 0) | (no_digits_printed_yet == false)) then
+ device = digit | "0"
+ no_digits_printed_yet = false
+ end if
+ digit_number = digit_number - 1
+ end loop
+
end procedure
---
-----------------------------------------------------------------------------
-
-
Added: trunk/include/jal/print_ng.jal
==============================================================================
--- (empty file)
+++ trunk/include/jal/print_ng.jal Sat Apr 25 01:55:48 2009
@@ -0,0 +1,474 @@
+-- Title: Writes variables to output device
+-- Author: Joep Suijs and Stef Mientki, Copyright (c) 2007..2008, all
rights reserved.
+-- Adapted-by: Joep Suijs, Richard Zengerink
+--
+-- Compiler: >=2.2
+--
+-- This file is part of jallib (http://jallib.googlecode.com)
+-- Released under the ZLIB license
(http://www.opensource.org/licenses/zlib-license.html)
+--
+-- Sources:
+--
+-- Description: Outputs variables to output device.
+-- formats: _decimal and _hex
+-- vars: bit, byte, sbyte, word, sword, dword, sdword
+-- --
+-- Example:
+-- --
+-- var sword BHL = -684
+-- --
+-- ; print the signed word to the LCD display
+-- print_sword_dec(LCD_char, BHL)
+-- --
+-- ; and now print the same signed word to the serial port
+-- print_sword_dec(Serial_HW_data, BHL)
+--
+-- Notes:
+--
+
+; prototypes
+
+procedure print_byte_binary(volatile byte out device, byte in data)
+procedure _print_universal_dec (volatile byte out device, dword in data,
byte in digit_number, byte in decp)
+procedure _print_suniversal_dec (volatile byte out device, sdword in data,
byte in digit_number, byte in decp)
+
+const byte nibble2hex[] = "0123456789ABCDEF" -- conversion string
+
+
+--
-----------------------------------------------------------------------------
+-- global vars
+--
-----------------------------------------------------------------------------
+
+var bit _print_signed
+var bit _print_overflow
+
+--
-----------------------------------------------------------------------------
+--
-----------------------------------------------------------------------------
+--procedure _write_digit(volatile byte out device, byte in digit, bit in
point) is
+
+-- _format_digit = digit
+-- if point then
+-- _write_real_digit(device)
+-- device = "."
+-- else
+ -- if _format_digit == 0 then device = _format_leader
+ -- else _write_real_digit(device)
+ -- end if
+ -- end if
+
+--end procedure
+--
-----------------------------------------------------------------------------
+
+
+
+
+
+procedure print_crlf(volatile byte out device) is
+ device = 13 -- ASCII CR (cariage return)
+ device = 10 -- ASCII LF (line feed)
+end procedure
+
+procedure print_string(volatile byte out device, byte in str[]) is
+ var word len = count(str)
+ var byte i
+
+ for len using i loop
+ device = str[i]
+ end loop
+
+end procedure
+
+procedure print_bit_truefalse(volatile byte out device, bit in data) is
+
+ const byte str1[] = "true"
+ const byte str0[] = "false"
+
+ if (data) then
+ print_string(device, str1)
+ else
+ print_string(device, str0)
+ end if
+
+end procedure
+
+procedure print_bit_highlow(volatile byte out device, bit in data) is
+
+ const byte str1[] = "high"
+ const byte str0[] = "low"
+
+ if (data) then
+ print_string(device, str1)
+ else
+ print_string(device, str0)
+ end if
+
+end procedure
+
+procedure print_bit_10(volatile byte out device, bit in data) is
+
+ if (data) then
+ device = "1"
+ else
+ device = "0"
+ end if
+
+end procedure
+
+procedure print_dword_binary(volatile byte out device, dword in data) is
+
+ print_byte_binary(device, byte(data>>24))
+ print_byte_binary(device, byte(data>>16))
+ print_byte_binary(device, byte(data>>8))
+ print_byte_binary(device, byte(data))
+
+end procedure
+
+procedure print_word_binary(volatile byte out device, word in data) is
+
+ print_byte_binary(device, byte(data>>8))
+ print_byte_binary(device, byte(data))
+
+end procedure
+
+procedure print_byte_binary(volatile byte out device, byte in data) is
+
+ for 8 loop
+ if ((data & 0x80) != 0) then
+ device = "1"
+ else
+ device = "0"
+ end if
+ data = data * 2
+ end loop
+
+
+end procedure
+
+procedure print_dword_hex(volatile byte out device, dword in data) is
+
+ device = nibble2hex[0x0F & (data>>28)]
+ device = nibble2hex[0x0F & (data>>24)]
+ device = nibble2hex[0x0F & (data>>20)]
+ device = nibble2hex[0x0F & (data>>16)]
+ device = nibble2hex[0x0F & (data>>12)]
+ device = nibble2hex[0x0F & (data>>8)]
+ device = nibble2hex[0x0F & (data>>4)]
+ device = nibble2hex[0x0F & (data)]
+
+end procedure
+
+procedure print_word_hex(volatile byte out device, word in data) is
+
+ device = nibble2hex[0x0F & (data>>12)]
+ device = nibble2hex[0x0F & (data>>8)]
+ device = nibble2hex[0x0F & (data>>4)]
+ device = nibble2hex[0x0F & (data)]
+
+end procedure
+
+procedure print_byte_hex(volatile byte out device, byte in data) is
+
+ device = nibble2hex[0x0F & (data>>4)]
+ device = nibble2hex[0x0F & (data)]
+
+end procedure
+
+procedure print_sdword_dec(volatile byte out device, sdword in data, byte
in digit_number, byte in decp) is
+
+ _print_suniversal_dec (device, data, digit_number, decp)
+
+end procedure
+
+procedure print_sword_dec(volatile byte out device, sword in data, byte in
digit_number, byte in decp) is
+
+ _print_suniversal_dec (device, data, digit_number, decp)
+
+end procedure
+
+procedure print_sbyte_dec(volatile byte out device, sbyte in data, byte in
digit_number, byte in decp) is
+
+ _print_suniversal_dec (device, data, digit_number, decp)
+
+end procedure
+
+procedure print_dword_dec(volatile byte out device, dword in data, byte in
digit_number, byte in decp) is
+
+ _print_universal_dec (device, data, digit_number, decp)
+
+end procedure
+
+
+procedure print_word_dec(volatile byte out device, word in data, byte in
digit_number, byte in decp) is
+
+ _print_universal_dec (device, data, digit_number, decp)
+
+end procedure
+
+
+procedure print_byte_dec(volatile byte out device, byte in data, byte in
digit_number, byte in decp) is
+
+ _print_universal_dec (device, data, digit_number, decp)
+
+end procedure
+
+--
----------------------------------------------------------------------------
+procedure _print_suniversal_dec(volatile byte out device, sdword in data,
byte in digit_number, byte in decp) is
+
+ _print_signed = false
+
+ if (data < 0) then
+ data = -data
+ _print_signed = true
+ digit_number = digit_number - 1
+ end if
+
+ _print_universal_dec (device, data, digit_number, decp)
+
+end procedure
+
+
+
+
+--
----------------------------------------------------------------------------
+
+procedure _print_universal_dec(volatile byte out device, dword in data,
byte in digit_number, byte in decp) is
+ var dword max_value = 1
+ var dword max_value_dp = 1
+ var byte digit
+ var byte maxdigit = 0
+
+ var bit no_digits_printed_yet = true;
+ var bit dp_set = false
+
+
+ _print_overflow = false
+ maxdigit = digit_number
+
+
+ if (decp != 0) then
+ digit_number = digit_number - 1
+ else
+ dp_set = true
+ end if
+
+ for digit_number loop
+ max_value = max_value * 10
+ end loop
+
+ if data >= max_value then
+ _print_overflow = true
+ end if
+
+ if digit_number == 0 then
+ _print_overflow = true
+ maxdigit = 1
+ end if
+
+ if _print_overflow | (decp > maxdigit) then
+ for maxdigit loop
+ device = "#"
+ end loop
+ return
+ end if
+
+ if _print_signed then
+ device = "-"
+ _print_signed = false
+ end if
+
+ if (data == 0) then
+ device = "0"
+ for ( digit_number - 1) loop
+ device = " "
+ end loop
+ return
+ end if
+
+ for decp loop
+ max_value_dp = max_value_dp * 10
+ end loop
+
+ if data < max_value_dp then
+ device = "0"
+ no_digits_printed_yet = false
+ end if
+
+ while (max_value > 0) loop
+ if decp == digit_number & !dp_set then
+ device = "."
+ dp_set = true
+
+ else
+ digit = byte ( data / max_value )
+ data = data % max_value
+ max_value = max_value / 10
+ if ((digit != 0) | (no_digits_printed_yet ==
false)) then
+ device = digit | "0"
+ no_digits_printed_yet = false
+ digit_number = digit_number - 1
+ end if
+ end if
+ end loop
+
+ if digit_number > 0 then
+ for digit_number loop
+ device = " "
+ end loop
+ end if
+end procedure
+
+
+--
-----------------------------------------------------------------------------
+-- Displays a date in DD[seperator]MM[seperator]YY if YEAR < 99 and
day_mounth_notation = true
+-- or DD[seperator]MM[seperator]YYYY if YEAR > 99 and day_mounth_notation
= true
+-- or switches DD and MM if day_mounth_notation = false
+--
-----------------------------------------------------------------------------
+procedure print_date( volatile byte out device, byte in day, byte in
mounth, word in year, byte in seperator, bit in day_mounth_notation ) is
+ var byte day_digit0 = 0 ;l
+ var byte day_digit1 = 0 ;10
+ var byte mounth_digit0 = 0 ;1
+ var byte mounth_digit1 = 0 ;10
+ var word year_digit0 = 0 ;1
+ var byte year_digit1 = 0 ;10
+ var byte year_digit2 = 0 ;100
+ var byte year_digit3 = 0 ;1000
+ var word year_mem = year
+
+
+ while day >= 10 loop
+ day_digit1 = day_digit1 + 1
+ day = day - 10
+ end loop
+ day_digit0 = day + 48
+ day_digit1 = day_digit1 + 48
+ while mounth >= 10 loop
+ mounth_digit1 = mounth_digit1 + 1
+ mounth = mounth - 10
+ end loop
+ mounth_digit0 = mounth +48
+ mounth_digit1 = mounth_digit1 + 48
+
+
+
+ while year >= 1000 loop
+ year_digit3 = year_digit3 + 1
+ year = year - 1000
+ end loop
+
+ while year >= 100 loop
+ year_digit2 = year_digit2 + 1
+ year = year - 100
+ end loop
+
+ while year >= 10 loop
+ year_digit1 = year_digit1 + 1
+ year = year - 10
+ end loop
+ year_digit3 = year_digit3 + 48
+ year_digit2 = year_digit2 + 48
+ year_digit1 = year_digit1 + 48
+ year_digit0 = year + 48
+
+
+ if !day_mounth_notation then
+ device = mounth_digit1
+ device = mounth_digit0
+ device = seperator
+ device = day_digit1
+ device = day_digit0
+ device = seperator
+ else
+ device = day_digit1
+ device = day_digit0
+ device = seperator
+ device = mounth_digit1
+ device = mounth_digit0
+ device = seperator
+ end if
+
+ if year_mem > 99 then
+ device = year_digit3
+ device = year_digit2
+ else
+ device = "'"
+ end if
+
+ device = year_digit1
+ device = year_digit0
+
+end procedure
+--
----------------------------------------------------------------------------
+
+
+--
-----------------------------------------------------------------------------
+-- Displays a time in HH:MM notation at specified position
+-- Hours and minutes are specified separate
+--
-----------------------------------------------------------------------------
+procedure print_time_hm(volatile byte out device,byte in HH, byte in MM) is
+ var byte D10
+
+ D10 = HH / 10
+ HH = HH % 10
+
+ -- always dsiplay Zeroes
+ device = "0" + D10
+ device = "0" + HH
+ device = ":"
+
+ D10 = MM / 10
+ MM = MM % 10
+
+ device = "0" + D10
+ device = "0" + MM
+end procedure
+--
-----------------------------------------------------------------------------
+
+--
-----------------------------------------------------------------------------
+-- Displays a time in HH:MM:SS notation at specified position
+-- Hours and minutes and secounds are specified separate
+--
-----------------------------------------------------------------------------
+procedure print_time_hms(volatile byte out device,byte in HH, byte in MM,
byte in SS) is
+ var byte D10
+
+ D10 = HH / 10
+ HH = HH % 10
+
+ -- always display Zeroes
+ device = "0" + D10
+ device = "0" + HH
+ device = ":"
+
+ D10 = MM / 10
+ MM = MM % 10
+
+ device = "0" + D10
+ device = "0" + MM
+ device = ":"
+
+ D10 = SS / 10
+ SS = SS % 10
+
+ device = "0" + D10
+ device = "0" + SS
+end procedure
+--
-----------------------------------------------------------------------------
+
+
+--
-----------------------------------------------------------------------------
+-- Displays a time in HH:MM notation at specified position
+-- the input is specified in minutes
+--
-----------------------------------------------------------------------------
+procedure print_time_hm_word(volatile byte out device,word in minutes) is
+ var byte D10
+ var byte HH
+ var byte MM
+
+ HH = byte(minutes / 60)
+ MM = byte(minutes % 60)
+ HH = HH % 24
+
+ print_time_hm(device, HH, MM)
+end procedure
+--
-----------------------------------------------------------------------------
+
+
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---