annotate src/wait.asm @ 381:e32f424223fb

BUGFIX: Battery consumption calculation in sleep mode (3,6V battery only)
author heinrichsweikamp
date Sat, 19 Sep 2015 13:41:40 +0200
parents 653a3ab08062
children b455b31ce022
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File wait.asm
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Wait routines
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
heinrichsweikamp
parents:
diff changeset
10 ; 2004-01-31 : [chsw] Initial version.
heinrichsweikamp
parents:
diff changeset
11 ; 2007-05-11 : Updated (OSTC code).
heinrichsweikamp
parents:
diff changeset
12 ; 2011-10-18 : [mH] Timings tested with oscilloscope
heinrichsweikamp
parents:
diff changeset
13
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 0
diff changeset
14 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
15
heinrichsweikamp
parents:
diff changeset
16 basic CODE
heinrichsweikamp
parents:
diff changeset
17
heinrichsweikamp
parents:
diff changeset
18 ; ==========================================================
heinrichsweikamp
parents:
diff changeset
19 ; WAIT 1 MILLISECOND (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
heinrichsweikamp
parents:
diff changeset
20 ; ==========================================================
heinrichsweikamp
parents:
diff changeset
21
heinrichsweikamp
parents:
diff changeset
22 global WAITMSX
heinrichsweikamp
parents:
diff changeset
23 WAITMSX movwf waitms_temp
heinrichsweikamp
parents:
diff changeset
24
heinrichsweikamp
parents:
diff changeset
25 WAITMSX2 setf TMR5H
heinrichsweikamp
parents:
diff changeset
26 movlw .255-.32 ;32 x 31,5µs = 1,008ms
heinrichsweikamp
parents:
diff changeset
27 movwf TMR5L
heinrichsweikamp
parents:
diff changeset
28 bcf PIR5,TMR5IF ; Clear flag
heinrichsweikamp
parents:
diff changeset
29 WAITMSX3 btfss PIR5,TMR5IF
heinrichsweikamp
parents:
diff changeset
30 bra WAITMSX3 ; Wait loop
heinrichsweikamp
parents:
diff changeset
31 decfsz waitms_temp,F
heinrichsweikamp
parents:
diff changeset
32 bra WAITMSX2
heinrichsweikamp
parents:
diff changeset
33 return
heinrichsweikamp
parents:
diff changeset
34
heinrichsweikamp
parents:
diff changeset
35 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
36
heinrichsweikamp
parents:
diff changeset
37 END