This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

rtc with 8051

my asm code for rtc interface with 8051 is as follows:
org 0
MOV A,#38H
ACALL CMND
ACALL DELAY
MOV A,#0EH
ACALL CMND
ACALL DELAY
MOV A,#01H
ACALL CMND
ACALL DELAY
MOV A,#80H
ACALL CMND
ACALL DELAY
;--------------------
ACALL DELAY1
MOV R0,#0Ah ; Load the address of control register A in register R0
MOV A,#20h ; Load D6-D4 (010) to start oscillator
MOV @R0,A ; Turn ON Oscillator
MOV R0,#0Bh ; Load the address of control register B in register R0
MOV A,#83h ; BCD, 24 Hours, D7=1 (No update)
MOV @R0,A ; Turn ON Oscillator
MOV R0,#00h ; Load the address of SECOND register in register R0
MOV A,#10h ; Load 10 second
MOV @R0,A ; Load in second address
MOV R0,#02h ; Load the address of minute register B in register R0
MOV A,#10h ; Load 10 minute
MOV @R0,A ; Load in minute address
MOV R0,#04h ; Load the address of hour register B in register R0
MOV A,#10h ; Load 10 hour
MOV @R0,A ; Load in hour address
MOV R0,#0Bh ; Load the address of control register B in register R0
MOV A,#03h ; Control register bit D7=0 (Allow update)
MOV @R0,A ; Send to control register
READ_AGAIN:
MOV R0,#14h ; Hour address
MOVX A,@R0
ACALL DISP_DATA
MOV R0,#12h ; Minute address
MOVX A,@R0 ; Load current minute in accumulator
ACALL DISP_DATA
MOV R0,#10h ; Second address
MOVX A,@R0 ; Load current minute in accumulator
ACALL DISP_DATA
AJMP READ_AGAIN
DISP_DATA:
MOV B,A
SWAP A
ANL A,#0Fh
ORL A,#30h
ACALL LCD_DATA
MOV A,B
ANL A,#0Fh
ORL A,#30h
ACALL LCD_DATA
RET
;-------------------
CMND:MOV P1,A
CLR P3.0
SETB P3.1
ACALL DELAY
CLR P3.1
RET
LCD_DATA: MOV P1,A
SETB P3.0
SETB P3.1
ACALL DELAY
CLR P3.1
RET
DELAY: MOV R0,#200
H1:MOV R1,#200
HE: DJNZ R1,HE
DJNZ R0,H1
RET
DELAY1: MOV TMOD,#01H
MOV TL0,#00H
MOV TH0,#00H
SETB TR0
D1: JNB TF0,D1
CLR TF0
CLR TR0
RET
END

the problem is that i am not getting the right time display at lcd plz sombdy help me

Parents
  • 1) You didn't think it interesting to describe what results you do get, and what results you expected?

    2) You didn't think it interesting to tell us what debugging you have done?

    What motivation do you see for people to spend their spare time reading your code and try to figure out what is wrong? Especially since a large section of your code is void of any comments.

Reply
  • 1) You didn't think it interesting to describe what results you do get, and what results you expected?

    2) You didn't think it interesting to tell us what debugging you have done?

    What motivation do you see for people to spend their spare time reading your code and try to figure out what is wrong? Especially since a large section of your code is void of any comments.

Children
No data