Mercurial > public > hwos_code
diff 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 |
line wrap: on
line diff
--- a/src/rtc.asm Thu Nov 29 10:50:57 2018 +0100 +++ b/src/rtc.asm Mon Jan 07 21:13:43 2019 +0100 @@ -34,41 +34,41 @@ global rtc_set_rtc rtc_set_rtc: - banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM - movlw 0x55 - movwf EECON2 - movlw 0xAA - movwf EECON2 - bsf RTCCFG,RTCWREN ; Unlock sequence for RTCWREN - bsf RTCCFG,RTCPTR1 - bsf RTCCFG,RTCPTR0 ; year + banksel 0xF16 ; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM. + movlw 0x55 + movwf EECON2 + movlw 0xAA + movwf EECON2 + bsf RTCCFG,RTCWREN ; Unlock sequence for RTCWREN + bsf RTCCFG,RTCPTR1 + bsf RTCCFG,RTCPTR0 ; year movff year,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! movwf RTCVALL ; year movwf RTCVALH ; dummy write movff day,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALL ; day + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALL ;day movff month,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALH ; month + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALH ;month movff hours,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALL ; hours + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALL ;hours movlw d'0' - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALH ; weekday + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALH ;weekday movff secs,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALL ; secs + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALL ;secs movff mins,WREG - rcall rtc_dec2bcd ; IN: WREG in decimal, OUT: WREG in BCD, also sets to bank16h! - movwf RTCVALH ; minutes - movlw 0x55 - movwf EECON2 - movlw 0xAA - movwf EECON2 - bcf RTCCFG,RTCWREN ; Lock sequence for RTCWREN + rcall rtc_dec2bcd ; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h! + movwf RTCVALH ;minutes + movlw 0x55 + movwf EECON2 + movlw 0xAA + movwf EECON2 + bcf RTCCFG,RTCWREN ; Lock sequence for RTCWREN banksel common return