Mercurial > public > hwos_code
comparison src/rtc.asm @ 604:ca4556fb60b9
bump to 2.99beta, work on 3.00 stable
author | heinrichsweikamp |
---|---|
date | Thu, 22 Nov 2018 19:47:26 +0100 |
parents | e1f0f5e3d4e4 |
children | d866684249bd |
comparison
equal
deleted
inserted
replaced
603:00b24fb4324d | 604:ca4556fb60b9 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File rtc.asm ## V2.98 | 3 ; File rtc.asm ## V2.98c |
4 ; | 4 ; |
5 ; | 5 ; |
6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
7 ;============================================================================= | 7 ;============================================================================= |
8 ; HISTORY | 8 ; HISTORY |
9 ; 2011-08-08 : [mH] moving from OSTC code | 9 ; 2011-08-08 : [mH] moving from OSTC code |
10 | 10 |
11 #include "hwos.inc" | 11 #include "hwos.inc" |
12 #include "math.inc" | 12 #include "math.inc" |
13 | 13 |
14 sensors CODE | 14 rtc CODE |
15 | 15 |
16 ;============================================================================= | 16 ;============================================================================= |
17 | 17 |
18 global rtc_init | 18 global rtc_init |
19 rtc_init: | 19 rtc_init: |
21 movwf secs | 21 movwf secs |
22 movlw .59 | 22 movlw .59 |
23 movwf mins | 23 movwf mins |
24 movlw .12 | 24 movlw .12 |
25 movwf hours | 25 movwf hours |
26 movlw .1 | 26 movlw .2 |
27 movwf day | 27 movwf day |
28 movlw .8 | 28 movlw .12 |
29 movwf month | 29 movwf month |
30 movlw .18 | 30 movlw .17 |
31 movwf year | 31 movwf year |
32 ; rcall rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | 32 ; rcall rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module |
33 ; return | 33 ; return |
34 | 34 |
35 global rtc_set_rtc | 35 global rtc_set_rtc |
37 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM | 37 banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM |
38 movlw 0x55 | 38 movlw 0x55 |
39 movwf EECON2 | 39 movwf EECON2 |
40 movlw 0xAA | 40 movlw 0xAA |
41 movwf EECON2 | 41 movwf EECON2 |
42 bsf RTCCFG,RTCWREN ; Unlock sequence for RTCWREN | 42 bsf RTCCFG,RTCWREN ; Unlock sequence for RTCWREN |
43 bsf RTCCFG,RTCPTR1 | 43 bsf RTCCFG,RTCPTR1 |
44 bsf RTCCFG,RTCPTR0 ; year | 44 bsf RTCCFG,RTCPTR0 ; year |
45 movff year,WREG | 45 movff year,WREG |
46 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 46 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! |
47 movwf RTCVALL ; year | 47 movwf RTCVALL ; year |
48 movwf RTCVALH ; dummy write | 48 movwf RTCVALH ; dummy write |
49 movff day,WREG | 49 movff day,WREG |
66 movwf RTCVALH ; minutes | 66 movwf RTCVALH ; minutes |
67 movlw 0x55 | 67 movlw 0x55 |
68 movwf EECON2 | 68 movwf EECON2 |
69 movlw 0xAA | 69 movlw 0xAA |
70 movwf EECON2 | 70 movwf EECON2 |
71 bcf RTCCFG,RTCWREN ; Lock sequence for RTCWREN | 71 bcf RTCCFG,RTCWREN ; Lock sequence for RTCWREN |
72 banksel common | 72 banksel common |
73 return | 73 return |
74 | 74 |
75 rtc_dec2bcd: | 75 rtc_dec2bcd: |
76 banksel lo | 76 banksel lo |