Mercurial > public > hwos_code
comparison src/convert.inc @ 634:4050675965ea
3.10 stable release
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2020 17:34:31 +0200 |
parents | cd58f7fc86db |
children | 75e90cd0c2c3 |
comparison
equal
deleted
inserted
replaced
633:690c48db7b5b | 634:4050675965ea |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File convert.inc combined next generation V3.04.2 | 3 ; File convert.inc combined next generation V3.09.4l |
4 ; | 4 ; |
5 ; Converts register values to string | 5 ; Converts register values to string |
6 ; | 6 ; |
7 ; Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
9 ; HISTORY | 9 ; HISTORY |
10 ; 2007-10-07 : [MH] Creation for OSTC sources | 10 ; 2007-10-07 : [MH] Creation for OSTC sources |
11 ; 2010-12-10 : [jDG] Optimize macro size | 11 ; 2010-12-10 : [jDG] Optimize macro size |
12 | 12 |
13 | 13 |
14 extern output16_3_call | 14 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
15 output_16_3 macro ; displays only last three digits from a 16 bit value (0-999) | 15 ; |
16 call output16_3_call | 16 ; The output format of all 8 and 16 bit integer printing |
17 ; functions can be controlled with the following flags. | |
18 ; After each printing, the flags are reset automatically. | |
19 ; | |
20 ; | |
21 ; bsf leftbind ; print left-aligned (no leading spaces) | |
22 ; bsf leading_zeros ; print leading zeros | |
23 ; | |
24 ; bsf hide_digit5 ; do not print digit 5 (clip output at 9999) | |
25 ; bsf hide_digit4 ; do not print digits 5 - 4 (clip output at 999) | |
26 ; bsf hide_digit3 ; do not print digits 5 - 3 (clip output at 99) | |
27 ; bsf hide_digit2 ; do not print digits 5 - 2 (clip output at 9) | |
28 ; | |
29 ; In case the output gets clipped, the flag 'output_overflow' will be set | |
30 ; | |
31 ; bsf omit_digit_2 ; do not print digits 2 - 1 (show output as xxx--) | |
32 ; bsf omit_digit_1 ; do not print digit 1 (show output as xxxx-) | |
33 ; | |
34 ; bsf decimal_digit3 ; put a decimal point in front of digit 3 (xx.xxx) | |
35 ; bsf decimal_digit2 ; put a decimal point in front of digit 2 (xxx.xx) | |
36 ; bsf decimal_digit1 ; put a decimal point in front of digit 1 (xxxx.x) | |
37 ; | |
38 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
39 | |
40 | |
41 ;----------------------------------------------------------------------------- | |
42 ; | |
43 ; Output Functions for 8 Bit Integers | |
44 ; | |
45 ; output_x: x is the max number that will be shown | |
46 ; | |
47 ; Input: mpr:1 (lo) | |
48 ; | |
49 ;----------------------------------------------------------------------------- | |
50 | |
51 output_9 macro ; print only last digit (0-9) | |
52 extern output9_call | |
53 call output9_call | |
17 endm | 54 endm |
18 | 55 |
19 extern output16_4_call | |
20 output_16_4 macro ; displays only last four digits from a 16 bit value (0-9999) | |
21 call output16_4_call | |
22 endm | |
23 | 56 |
24 extern output16 | 57 output_99 macro ; print only 2 digits (0-99) |
25 output_16dp macro dp_position ; 16 bit with decimal point | |
26 movlw dp_position | |
27 call output16 | |
28 endm | |
29 | |
30 extern output16_call | |
31 output_16 macro ; 16 bit normal | |
32 call output16_call | |
33 endm | |
34 | |
35 extern output8_call | |
36 output_8 macro ; 8 bit normal | |
37 call output8_call | |
38 endm | |
39 | |
40 extern output99_call | 58 extern output99_call |
41 output_99 macro ; displays only last two digits from a 8 bit value (0-99) | |
42 call output99_call | 59 call output99_call |
43 endm | 60 endm |
44 | 61 |
62 output_99x macro ; print only 2 digits with leading zero (00-99) | |
45 extern output99x_call | 63 extern output99x_call |
46 output_99x macro ; displays only last two digits from a 8 bit value with leading zero (00-99) | |
47 call output99x_call | 64 call output99x_call |
48 endm | 65 endm |
49 | 66 |
67 output_99dd macro ; print only 2 digits or double-dots if zero - variant for small font | |
50 extern output99dd_call | 68 extern output99dd_call |
51 output_99dd macro ; displays only last two digits from a 8 bit value, prints double-dots if zero - small fonts | |
52 call output99dd_call | 69 call output99dd_call |
53 endm | 70 endm |
54 | 71 |
72 output_99DD macro ; print only 2 digits or double-dots if zero - variant for big font | |
55 extern output99DD_call | 73 extern output99DD_call |
56 output_99DD macro ; displays only last two digits from a 8 bit value, prints double-dots if zero - big fonts | |
57 call output99DD_call | 74 call output99DD_call |
58 endm | 75 endm |
59 | 76 |
77 output_256 macro ; print all 3 digits (0-255) | |
78 extern output256_call | |
79 call output256_call | |
80 endm | |
81 | |
82 output_hex macro ; print in hex (00-FF), Attention: input is via WREG | |
60 extern outputHEX_call | 83 extern outputHEX_call |
61 output_hex macro ; displays 8 bit integer in hex, input via WREG | |
62 call outputHEX_call | 84 call outputHEX_call |
63 endm | 85 endm |
86 | |
87 | |
88 ;----------------------------------------------------------------------------- | |
89 ; | |
90 ; Output Functions for 16 Bit Integers | |
91 ; | |
92 ; output_x: x is the max number that will be shown | |
93 ; | |
94 ; Input: mpr:2 (lo,hi) | |
95 ; | |
96 ;----------------------------------------------------------------------------- | |
97 | |
98 output_65535 macro ; print all 5 digits (0-65535) | |
99 extern output65535_call | |
100 call output65535_call | |
101 endm | |
102 | |
103 | |
104 output_9999 macro ; print only last 4 digits (0-9999) | |
105 extern output9999_call | |
106 call output9999_call | |
107 endm | |
108 | |
109 output_999 macro ; print only last 3 digits (0-999) | |
110 extern output999_call | |
111 call output999_call | |
112 endm | |
113 | |
114 | |
115 ;----------------------------------------------------------------------------- | |
116 ; | |
117 ; Conversion Functions | |
118 ; | |
119 ;----------------------------------------------------------------------------- | |
120 | |
121 extern convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
122 extern convert_cm_to_feet ; convert depth in [cm] to depth in [feet] | |
123 extern convert_meter_to_feet ; convert depth in [m] to depth in [feet] | |
124 extern convert_celsius_to_fahrenheit ; convert temperature from celsius to fahrenheit | |
125 extern convert_signed_16bit ; convert signed to unsigned 16bit, print '-' if negative | |
126 extern convert_time ; convert minutes to hours:minutes or seconds to minutes:seconds | |
127 | |
128 extern output_date ; print date with day, month and year | |
129 extern output_date_short ; print date with day and month only | |
130 extern output_secs_as_days_hours ; print seconds as days and hours | |
131 | |
132 ;----------------------------------------------------------------------------- | |
133 | |
134 |