annotate code_part1/OSTC_code_asm_part1/MAIN.ASM @ 644:420e62cd88ad

point to correct diluent location
author heinrichsweikamp
date Wed, 03 Oct 2012 13:12:02 +0200
parents e3ffc6d62a63
children c6220d340684
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
482
8e1fb9cdd62a lock sensor for surfacemode until value is stable
heinrichsweikamp
parents: 454
diff changeset
3 ; Copyright (C) 2008-2011 HeinrichsWeikamp GbR
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; includes and isr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 041013
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 081219
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 LIST P=18F4685 ;directive to define processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 #include <P18F4685.INC> ;processor specific variable definitions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 #include definitions.asm ; Defines, I/O Ports and variables
494
e9b1f162799d testing graphical velocity
heinrichsweikamp
parents: 492
diff changeset
31 #include shared_definitions.h
164
999abb01c78f + Change data allocation scheme
JeanDo
parents: 141
diff changeset
32
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
33 reset_v code 0x0000
164
999abb01c78f + Change data allocation scheme
JeanDo
parents: 141
diff changeset
34 goto start ; Start!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
36 inter_v code 0x0008
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 bra HighInt ;High Priority Interrups
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38
353
b5b030c1ae7e Avoid spurious switch-depth stops with 3 or more gas.
JeanDo
parents: 344
diff changeset
39 inter_asm code 0x0018 ;Low Priority Interrups
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 ; *** low priority interrupts not used
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 bra HighInt ;High Priority Interrups
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 HighInt:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 movlb b'00000001' ;select Bank1
92
82de387d6e7c Interrupt trashes the PRODH:L registers.
JeanDo
parents: 83
diff changeset
45 movff PRODL,prod_temp+0
82de387d6e7c Interrupt trashes the PRODH:L registers.
JeanDo
parents: 83
diff changeset
46 movff PRODH,prod_temp+1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47
553
97b11ff4bcea minor cleanup
heinrichsweikamp
parents: 552
diff changeset
48 movf PORTB,W ; move portb into latch register
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49
553
97b11ff4bcea minor cleanup
heinrichsweikamp
parents: 552
diff changeset
50 btfsc PIR1,TMR1IF ; Timer1 INT (external 32.768kHz Clock)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 call timer1int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52
553
97b11ff4bcea minor cleanup
heinrichsweikamp
parents: 552
diff changeset
53 btfsc INTCON,TMR0IF ; Timer0 INT (Debounce Timer)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 call timer0int
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 btfsc PIR1,RCIF ; UART
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 call uartint
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 btfsc INTCON,INT0IF ; Switch left
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
60 call switch_left_int
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 btfsc INTCON3,INT1IF ; switch right
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
63 call switch_right_int
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64
92
82de387d6e7c Interrupt trashes the PRODH:L registers.
JeanDo
parents: 83
diff changeset
65 movff prod_temp+1,PRODH
82de387d6e7c Interrupt trashes the PRODH:L registers.
JeanDo
parents: 83
diff changeset
66 movff prod_temp+0,PRODL
543
0def530863c2 Use faster return from ISR
heinrichsweikamp
parents: 532
diff changeset
67 retfie FAST
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
69 ;=============================================================================
174
53b16a746166 Multi-lang
JeanDo
parents: 164
diff changeset
70 #include multilang_text.asm ; includes textmacros
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
71
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
72 ;=============================================================================
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
73 osct_asm code
97
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 92
diff changeset
74 #include strings.inc
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 92
diff changeset
75
341
2144f19fa1eb BUGFIX protect against ISR changing pressure/temperature while reading it.
JeanDo
parents: 238
diff changeset
76 #include isr.asm ; Interrupt service routine (RTC&Sensor)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 #include displaytext.asm ; sends texts to wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 #include math.asm ; mathematical functions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 #include wait.asm ; waitroutines
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
80 #include oled_samsung.asm ; Attached in 80-System 8-Bit Mode
577
e3ffc6d62a63 minor clean
heinrichsweikamp
parents: 553
diff changeset
81 #include aa_wordprocessor.asm; New antialiased word processor and fonts
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
82 #include color_processor.asm ; Color image drawing.
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 238
diff changeset
83 #include dump_screen.asm ; Copy screen contains to serial interface
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 #include valconv.asm ; outputs to POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 #include eeprom_rs232.asm ; Internal EEPROM and RS232 Interface
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86 #include menu_custom.asm ; Menu "Custom FunctionsI" and "Custom FunctionsII"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 #include menu.asm ; Main Menu and Setup Menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 #include menu_reset.asm ; Submenu "Reset"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89 #include menu_settime.asm ; Submenu "Set Time"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 #include ms5535.asm ; Interface to MS5535A,B or C pressure sensor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 #include pled_outputs.asm ; div. PLED outputs and background debugger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92 #include i2c_eeprom.asm ; for external I2C EEPROM and general I2C Routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 #include menu_logbook.asm ; Submenu "Logbook"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 #include interface.asm ; Interface routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 #include menu_ppO2.asm ; Constant ppO2 setup menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 #include menu_battery.asm ; Submenu "Battery Info"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 #include menu_gassetup.asm ; Menu "Gas Setup"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 #include surfmode.asm ; Mainroutines for Surfacemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 #include divemode.asm ; Mainroutines for Divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 #include divemode_menu.asm ; Underwater menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101 #include sleepmode.asm ; Mainroutines for Sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 #include adc_rtc.asm ; A/D converter (battery control) and RTC init
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 #include temp_extrema.asm ; Takes care of the temperature extrema logger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 #include sync_clock.asm ; syncs RTC with PC
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 #include start.asm ; Startup and init, checks background debugger
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 #include simulator.asm ; Stand-alone simulator routines
98
6f8e3a08011e 1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents: 97
diff changeset
107 #include customview.asm ; Customview for divemode
97
dc349e4264bb Cleanup CF for bad 15bits value display
JeanDo
parents: 92
diff changeset
108 #include strings.asm ; Basic string operations
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109
125
2907b42c195b Altimeter:
JeanDo
parents: 123
diff changeset
110 #include altimeter.asm
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
111 ;=============================================================================
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
112 #include dive_icons.asm ; Draw dive type icons in surface mode.
62
2972a06b0785 1.71 beta in work
heinrichsweikamp
parents: 58
diff changeset
113
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 62
diff changeset
114 ;=============================================================================
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
115 ; Extracted from p3_wordprocessor includes:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
116 #include aa_fonts.asm
110
8aa8acada0fd Display deco-type icon in surface mode.
JeanDo
parents: 98
diff changeset
117
8aa8acada0fd Display deco-type icon in surface mode.
JeanDo
parents: 98
diff changeset
118 ;=============================================================================
552
44e9b961f156 Compute ppO2 for pSCR diving
heinrichsweikamp
parents: 543
diff changeset
119 MESSG "OSTC - diving computer code, Copyright (C) 2012 HeinrichsWeikamp"
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 MESSG "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 MESSG "Free Software Foundation, either version 3 of the License, or (at your option) any later version."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 MESSG "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 MESSG "or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 MESSG "You should have received a copy of the GNU General Public License along with this program.If not, see http://www.gnu.org/licenses/."
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125
238
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
126 ifdef __DEBUG
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
127 MESSG "OSTC Mk.2 code compiled in DEBUG configuration!"
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
128 else
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
129 MESSG "OSTC Mk.2 code compiled in RELEASE configuration!"
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
130 endif
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
131
9581e48a914f Some cleanup in the ISR
heinrichsweikamp
parents: 174
diff changeset
132
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 END ; end of program
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134