annotate src/wait.asm @ 628:cd58f7fc86db

3.05 stable work
author heinrichsweikamp
date Thu, 19 Sep 2019 12:01:29 +0200
parents c40025d8e750
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
3 ; File wait.asm combined next generation V3.02.1
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
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
16 wait CODE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
17
0
heinrichsweikamp
parents:
diff changeset
18
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
19 ; =============================================================================
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
20 ; WAIT 1 second
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
21 ; Warning: Do not use for time critical routines - can be between 0 and 1 sec!
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
22 ; =============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
23
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
24 global wait_1s
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
25 wait_1s:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
26 bcf trigger_full_second ; clear any left-over trigger
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
27 btfss trigger_full_second ; did a new trigger occurred?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
28 bra $-2 ; NO - loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
29 return ; YES - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
30
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
31
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
32 ; =============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
33 ; WAIT for multiples of 1 Millisecond
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
34 ; Remark: not exact: 1.008 ms +/- 30.5 µs + worst case ISR latency
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
35 ; =============================================================================
0
heinrichsweikamp
parents:
diff changeset
36
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
37 global WAITMSX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
38 WAITMSX:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
39 movwf wait_counter ; store number of milliseconds to wait
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
40 WAITMSX2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
41 setf TMR5H ; initialize timer 5, high byte first
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
42 movlw .255-.32 ; 32 x 31.5 µs = 1.008 ms
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
43 movwf TMR5L ; initialize timer 5, low byte thereafter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
44 bcf PIR5,TMR5IF ; clear timer 5 overrun flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
45 WAITMSX3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
46 btfss PIR5,TMR5IF ; did timer 5 overrun?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
47 bra WAITMSX3 ; NO - repeat inner loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
48 decfsz wait_counter,F ; YES - decrement number of milliseconds to do, done?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
49 bra WAITMSX2 ; NO - repeat outer loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
50 return ; YES - done
0
heinrichsweikamp
parents:
diff changeset
51
heinrichsweikamp
parents:
diff changeset
52 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
53
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 275
diff changeset
54 END