annotate code_part1/OSTC_code_asm_part1/wait.asm @ 549:cdc1163a8e9e

minor docu update
author heinrichsweikamp
date Thu, 02 Feb 2012 16:05:09 +0100
parents e33a8ac4b660
children c50296c3059e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; Wait routines
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; written by: chsw, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; written: 01/31/04
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; last updated: 11/05/07
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; ==========================================================
522
e33a8ac4b660 New ASSERT_BANK1 macro for software proofing.
JeanDo
parents: 521
diff changeset
21 ; WAIT 10 MICROSECONDS - 16 Mhz and 32 Mhz
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; ==========================================================
485
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
23
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
24 IFDEF SPEED_16MHz
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25 WAIT10US macro wait_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 movlw wait_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 call WAIT10USX
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 endm
485
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
29 ENDIF
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
30
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
31 IFDEF SPEED_32MHz
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
32 WAIT10US macro wait_temp
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
33 movlw wait_temp
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
34 call WAIT10USX
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
35 movlw wait_temp
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
36 call WAIT10USX
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
37 endm
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
38 ENDIF
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 WAIT10USX movwf wait_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 goto JumpIn10us
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 WAIT10USX2 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 nop
470
42acd9316f7a fine-tune waits for 16MHz
heinrichsweikamp
parents: 0
diff changeset
50 JumpIn10us:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 decfsz wait_temp,1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 goto WAIT10USX2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83 ; ==========================================================
486
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
84 ; WAIT 1 MILLISECOND - Working with TMR1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 ; ==========================================================
485
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
86 WAITMS macro waitms_temp
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
87 movlw waitms_temp
486
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
88 call WAITMSX
485
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
89 endm
486
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
90
522
e33a8ac4b660 New ASSERT_BANK1 macro for software proofing.
JeanDo
parents: 521
diff changeset
91 WAITMSX movwf waitms_temp ; Holds number of ms to wait
485
e83f883c96b2 quick fix for wrong wait routines
heinrichsweikamp
parents: 470
diff changeset
92
522
e33a8ac4b660 New ASSERT_BANK1 macro for software proofing.
JeanDo
parents: 521
diff changeset
93 ASSERT_BANK1 .10002 ; Make sure we are in bank1
521
33abbc08f01e Minor cleanups for TESTING=1 emulator mode.
JeanDo
parents: 486
diff changeset
94 Ifdef TESTING
33abbc08f01e Minor cleanups for TESTING=1 emulator mode.
JeanDo
parents: 486
diff changeset
95 return ; In emulation, just skips waits
33abbc08f01e Minor cleanups for TESTING=1 emulator mode.
JeanDo
parents: 486
diff changeset
96 Endif
486
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
97 WAITMSX1:
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
98 movf TMR1L,W
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
99 addlw d'66' ; 66*15,26µs ~ 1ms
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
100
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
101 WAITMSX2 cpfseq TMR1L
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
102 bra WAITMSX2 ; loop here...
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
103
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
104 decfsz waitms_temp,F
c7b663939737 making waitms speed-independent, desat-time fix
heinrichsweikamp
parents: 485
diff changeset
105 bra WAITMSX1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 return