Friday, December 23, 2011

Program for setting date in RTC DS12887

; TURNING ON RTC
MOV R0, #10    ; REGISTER A ADDRESS IN R0
MOV A, #20H    ; 010 TO TURN ON RTC
MOVX @RO,A    ; SEND IT TO REGISTER A OF RTC


; SETTING TIME MODE
; AS DECIDED WE SET BCD, 24 HRS, DAYLIGHT SAVING
; MEANING SENDING 83H TO REGISTER B OF RTC
MOV R0, #11    ; REGISTER B ADDRESS IN R0
MOV A, #83H    ; FOR REASONS SITED ABOVE
MOVX @R0, A    ; SEND IT TO REGISTER B OF RTC

; TURNING ON AND SETTING TIME MODE REMAINS SAME
; DURING ALL SETTING THINGS

; SETTING THE DATE
; LETS GET SOME THINGS CLEAR
; 07 - DAY OF MONTH
; 08 - MONTH
; 09 - YEAR
; FOR FULL TABLE SEE THE POST..

; SETTING DAY OF MONTH
MOV R0, #07    ; POINT TO THE DAY OF MONTH
MOV A, #20H    ; DAY = 20
MOVX @R0, A    ; SET DAY OF MONTH

; SETTING MONTH
MOV R0, #08    ; POINT TO MONTH
MOV A, #12H    ; MONTH = 12 = DECEMBER
MOVX @R0, A    ; SET THE MONTH

; SETTINH YEAR
MOV R0, #09    ; POINT TO YEAR
MOV A, #11H    ; FOR 2011
MOVX @R0, A    ; SET THE YEAR

; REGISTER B
MOV R0, #11    ; POINT TO REGISTER B
MOV A, #03    ; D7 = 0 TO ALLOW UPDATE
MOVX @R0, A    ; SEND IT TO REGISTER B


END

No comments:

Post a Comment