Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/wait.asm @ 760:e16e636def61
2.74 release
author | heinrichsweikamp |
---|---|
date | Sun, 01 Dec 2013 10:33:12 +0100 |
parents | e33a8ac4b660 |
children | c50296c3059e |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
3 ; This program is free software: you can redistribute it and/or modify | |
4 ; it under the terms of the GNU General Public License as published by | |
5 ; the Free Software Foundation, either version 3 of the License, or | |
6 ; (at your option) any later version. | |
7 ; This program is distributed in the hope that it will be useful, | |
8 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 ; GNU General Public License for more details. | |
11 ; You should have received a copy of the GNU General Public License | |
12 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
13 ; Wait routines | |
14 ; written by: chsw, info@heinrichsweikamp.com | |
15 ; written: 01/31/04 | |
16 ; last updated: 11/05/07 | |
17 ; known bugs: | |
18 ; ToDo: | |
19 | |
20 ; ========================================================== | |
522 | 21 ; WAIT 10 MICROSECONDS - 16 Mhz and 32 Mhz |
0 | 22 ; ========================================================== |
485 | 23 |
24 IFDEF SPEED_16MHz | |
0 | 25 WAIT10US macro wait_temp |
26 movlw wait_temp | |
27 call WAIT10USX | |
28 endm | |
485 | 29 ENDIF |
30 | |
31 IFDEF SPEED_32MHz | |
32 WAIT10US macro wait_temp | |
33 movlw wait_temp | |
34 call WAIT10USX | |
35 movlw wait_temp | |
36 call WAIT10USX | |
37 endm | |
38 ENDIF | |
0 | 39 |
40 WAIT10USX movwf wait_temp | |
41 goto JumpIn10us | |
42 WAIT10USX2 nop | |
43 nop | |
44 nop | |
45 nop | |
46 nop | |
47 nop | |
48 nop | |
49 nop | |
470 | 50 JumpIn10us: |
0 | 51 nop |
52 nop | |
53 nop | |
54 nop | |
55 nop | |
56 nop | |
57 nop | |
58 nop | |
59 nop | |
60 nop | |
61 nop | |
62 nop | |
63 nop | |
64 nop | |
65 nop | |
66 nop | |
67 nop | |
68 nop | |
69 nop | |
70 nop | |
71 nop | |
72 nop | |
73 nop | |
74 nop | |
75 nop | |
76 nop | |
77 nop | |
78 nop | |
79 nop | |
80 decfsz wait_temp,1 | |
81 goto WAIT10USX2 | |
82 return | |
83 ; ========================================================== | |
486
c7b663939737
making waitms speed-independent, desat-time fix
heinrichsweikamp
parents:
485
diff
changeset
|
84 ; WAIT 1 MILLISECOND - Working with TMR1 |
0 | 85 ; ========================================================== |
485 | 86 WAITMS macro waitms_temp |
87 movlw waitms_temp | |
486
c7b663939737
making waitms speed-independent, desat-time fix
heinrichsweikamp
parents:
485
diff
changeset
|
88 call WAITMSX |
485 | 89 endm |
486
c7b663939737
making waitms speed-independent, desat-time fix
heinrichsweikamp
parents:
485
diff
changeset
|
90 |
522 | 91 WAITMSX movwf waitms_temp ; Holds number of ms to wait |
485 | 92 |
522 | 93 ASSERT_BANK1 .10002 ; Make sure we are in bank1 |
521 | 94 Ifdef TESTING |
95 return ; In emulation, just skips waits | |
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 | 106 return |