Mercurial > public > hwos_code
comparison 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 |
comparison
equal
deleted
inserted
replaced
603:00b24fb4324d | 604:ca4556fb60b9 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File wait.asm V2.98 | 3 ; File wait.asm V2.98c |
4 ; | 4 ; |
5 ; Wait routines | 5 ; Wait routines |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
9 ; HISTORY | 9 ; HISTORY |
10 ; 2004-01-31 : [chsw] Initial version. | 10 ; 2004-01-31 : [chsw] initial version |
11 ; 2007-05-11 : Updated (OSTC code). | 11 ; 2007-05-11 : updated (OSTC code) |
12 ; 2011-10-18 : [mH] Timings tested with oscilloscope | 12 ; 2011-10-18 : [mH] timings tested with oscilloscope |
13 | 13 |
14 #include "hwos.inc" | 14 #include "hwos.inc" |
15 | 15 |
16 basic CODE | 16 wait CODE |
17 | |
18 | |
19 ; ========================================================== | |
20 ; WAIT 1 second (Warning: Do not use for time critical routines. Can be between 0 and 1 sec!) | |
21 ; ========================================================== | |
22 global wait_1s | |
23 wait_1s: | |
24 ; Wait until "next second" flag is set | |
25 bcf onesecupdate | |
26 btfss onesecupdate | |
27 bra $-2 | |
28 return | |
29 | |
17 | 30 |
18 ; ============================================================================= | 31 ; ============================================================================= |
19 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency) | 32 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency) |
20 ; ============================================================================= | 33 ; ============================================================================= |
21 | 34 |
22 global WAITMSX | 35 global WAITMSX |
23 WAITMSX: | 36 WAITMSX: |
24 movwf wait_counter | 37 movwf wait_counter |
25 WAITMSX2: | 38 WAITMSX2: |
26 setf TMR5H | 39 setf TMR5H |
27 movlw .255-.32 ;32 x 31,5µs = 1,008ms | 40 movlw .255-.32 ; 32 x 31,5µs = 1,008ms |
28 movwf TMR5L | 41 movwf TMR5L |
29 bcf PIR5,TMR5IF ; Clear flag | 42 bcf PIR5,TMR5IF ; clear flag |
30 WAITMSX3: | 43 WAITMSX3: |
31 btfss PIR5,TMR5IF | 44 btfss PIR5,TMR5IF |
32 bra WAITMSX3 ; Wait loop | 45 bra WAITMSX3 ; wait loop |
33 decfsz wait_counter,F | 46 decfsz wait_counter,F |
34 bra WAITMSX2 | 47 bra WAITMSX2 |
35 return | 48 return |
36 | 49 |
37 ;============================================================================= | 50 ;============================================================================= |