0
|
1 ;=============================================================================
|
|
2 ;
|
582
|
3 ; File wait.asm V2.98
|
0
|
4 ;
|
582
|
5 ; Wait routines
|
0
|
6 ;
|
|
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2004-01-31 : [chsw] Initial version.
|
|
11 ; 2007-05-11 : Updated (OSTC code).
|
|
12 ; 2011-10-18 : [mH] Timings tested with oscilloscope
|
582
|
13
|
275
|
14 #include "hwos.inc"
|
0
|
15
|
582
|
16 basic CODE
|
0
|
17
|
582
|
18 ; =============================================================================
|
|
19 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
|
|
20 ; =============================================================================
|
0
|
21
|
582
|
22 global WAITMSX
|
|
23 WAITMSX:
|
|
24 movwf wait_counter
|
|
25 WAITMSX2:
|
|
26 setf TMR5H
|
|
27 movlw .255-.32 ;32 x 31,5µs = 1,008ms
|
|
28 movwf TMR5L
|
|
29 bcf PIR5,TMR5IF ; Clear flag
|
|
30 WAITMSX3:
|
|
31 btfss PIR5,TMR5IF
|
|
32 bra WAITMSX3 ; Wait loop
|
|
33 decfsz wait_counter,F
|
|
34 bra WAITMSX2
|
|
35 return
|
0
|
36
|
|
37 ;=============================================================================
|
|
38
|
582
|
39 END |