Mercurial > public > hwos_code
comparison src/rtc.asm @ 608:d866684249bd
work on 2.99 stable
author | heinrichsweikamp |
---|---|
date | Mon, 07 Jan 2019 21:13:43 +0100 |
parents | ca4556fb60b9 |
children | c40025d8e750 |
comparison
equal
deleted
inserted
replaced
607:c5151a490d88 | 608:d866684249bd |
---|---|
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 |
36 rtc_set_rtc: | 36 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: temp1 in WREG, 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 |
50 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 50 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
51 movwf RTCVALL ; day | 51 movwf RTCVALL ;day |
52 movff month,WREG | 52 movff month,WREG |
53 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 53 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
54 movwf RTCVALH ; month | 54 movwf RTCVALH ;month |
55 movff hours,WREG | 55 movff hours,WREG |
56 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 56 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
57 movwf RTCVALL ; hours | 57 movwf RTCVALL ;hours |
58 movlw d'0' | 58 movlw d'0' |
59 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 59 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
60 movwf RTCVALH ; weekday | 60 movwf RTCVALH ;weekday |
61 movff secs,WREG | 61 movff secs,WREG |
62 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 62 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
63 movwf RTCVALL ; secs | 63 movwf RTCVALL ;secs |
64 movff mins,WREG | 64 movff mins,WREG |
65 rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! | 65 rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! |
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 |