annotate src/wait.asm @ 604:ca4556fb60b9

bump to 2.99beta, work on 3.00 stable
author heinrichsweikamp
date Thu, 22 Nov 2018 19:47:26 +0100
parents b455b31ce022
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
3 ; File wait.asm V2.98c
0
heinrichsweikamp
parents:
diff changeset
4 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
5 ; Wait routines
0
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
10 ; 2004-01-31 : [chsw] initial version
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
11 ; 2007-05-11 : updated (OSTC code)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
12 ; 2011-10-18 : [mH] timings tested with oscilloscope
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
13
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 0
diff changeset
14 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
15
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
16 wait CODE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
17
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
18
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
19 ; ==========================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
20 ; WAIT 1 second (Warning: Do not use for time critical routines. Can be between 0 and 1 sec!)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
21 ; ==========================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
22 global wait_1s
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
23 wait_1s:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
24 ; Wait until "next second" flag is set
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
25 bcf onesecupdate
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
26 btfss onesecupdate
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
27 bra $-2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
28 return
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
29
0
heinrichsweikamp
parents:
diff changeset
30
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
31 ; =============================================================================
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
32 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
33 ; =============================================================================
0
heinrichsweikamp
parents:
diff changeset
34
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
35 global WAITMSX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
36 WAITMSX:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
37 movwf wait_counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
38 WAITMSX2:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
39 setf TMR5H
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
40 movlw .255-.32 ; 32 x 31,5µs = 1,008ms
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
41 movwf TMR5L
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
42 bcf PIR5,TMR5IF ; clear flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
43 WAITMSX3:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
44 btfss PIR5,TMR5IF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
45 bra WAITMSX3 ; wait loop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
46 decfsz wait_counter,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
47 bra WAITMSX2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
48 return
0
heinrichsweikamp
parents:
diff changeset
49
heinrichsweikamp
parents:
diff changeset
50 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
51
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
52 END