Mercurial > public > hwos_code
comparison src/wait.asm @ 582:b455b31ce022
work on 2.97 stable
author | heinrichsweikamp |
---|---|
date | Mon, 26 Feb 2018 16:40:28 +0100 |
parents | 653a3ab08062 |
children | ca4556fb60b9 |
comparison
equal
deleted
inserted
replaced
581:f5de1ff88814 | 582:b455b31ce022 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File wait.asm | 3 ; File wait.asm V2.98 |
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 basic CODE |
17 | 17 |
18 ; ========================================================== | 18 ; ============================================================================= |
19 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency) | 19 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency) |
20 ; ========================================================== | 20 ; ============================================================================= |
21 | 21 |
22 global WAITMSX | 22 global WAITMSX |
23 WAITMSX movwf waitms_temp | 23 WAITMSX: |
24 | 24 movwf wait_counter |
25 WAITMSX2 setf TMR5H | 25 WAITMSX2: |
26 movlw .255-.32 ;32 x 31,5µs = 1,008ms | 26 setf TMR5H |
27 movwf TMR5L | 27 movlw .255-.32 ;32 x 31,5µs = 1,008ms |
28 bcf PIR5,TMR5IF ; Clear flag | 28 movwf TMR5L |
29 WAITMSX3 btfss PIR5,TMR5IF | 29 bcf PIR5,TMR5IF ; Clear flag |
30 bra WAITMSX3 ; Wait loop | 30 WAITMSX3: |
31 decfsz waitms_temp,F | 31 btfss PIR5,TMR5IF |
32 bra WAITMSX2 | 32 bra WAITMSX3 ; Wait loop |
33 return | 33 decfsz wait_counter,F |
34 bra WAITMSX2 | |
35 return | |
34 | 36 |
35 ;============================================================================= | 37 ;============================================================================= |
36 | 38 |
37 END | 39 END |