Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem in rtc ds12887A display

Status
Not open for further replies.

syedshah

Newbie level 1
Joined
Feb 18, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan
Activity points
1,296
Hi,
i am building up a clock using ds 12887a interfaced with microcontroller at89c51 taking display on 7segments.I have taken output of seconds,minutes and hours seprately and it is indeed working fine.But when i try to take display of minutes and seconds collectively,minutes are shown only for 2 seconds than seconds start ro dispay on segments dedicated for minutes.This action continues for 2 seconds than minutes are displayed again for 2 seconds and the cycle continues.Here is the code i have written for achieving the task.Please help me out anyone!!


ORG 000H
SJMP MAIN
MAIN:
;--------TURNING ON
MOV R0,#10
MOV A,#20H
MOVX @R0,A
;--------SETTING TIME MOD
MOV R0,#11
MOV A,#83H
MOVX @R0,A
;--------SETTING TIME
MOV R0,#0
MOV A,#55
MOVX @R0,A ; FOR SEC
MOV R0,#02
MOV A,#12
MOVX @R0,A ;FOR MIN
MOV R0,#04
MOV A,#04
MOVX @R0,A ;FOR HR
;--------TIME UPDATE
MOV R0,#11
MOV A,#04
MOVX @R0,A
;--------READ TIME

AGAIN:
MOV R0,#0 ;ADDRESS FOR SECONDS
MOVX A,@R0
MOV R1,A
MOV R0,#2 ;ADDRESS FOR MINUTES
MOVX A,@R0
MOV R2,A
ACALL DIVIDE
ACALL DIS1
ACALL DIS2

SJMP AGAIN ;REPEAT CYCLE



DIVIDE: ;CONVERSION TO BCD FOR DISPLAY ON 7 SEGMENTS

CLR A
CLR B
MOV A,R1
MOV B,#10
DIV AB
MOV R3,A
MOV R4,B
CLR A
CLR B
MOV A,R2
MOV B,#10
DIV AB
MOV R5,A
MOV R6,B
RET


DIS1: ;DISPLAY FOR SECONDS
CLR P3.2
CLR P3.3
CLR P3.1
SETB P3.0
MOV P2,R3
ACALL DELAY
CLR P3.0
SETB P3.1
MOV P2,R4
ACALL DELAY
CLR P3.1
RET

DIS2: ;DISPLAY FOR MINUTES
CLR P3.0
CLR P3.1
CLR P3.3
SETB P3.2
MOV P2,R5
ACALL DELAY
CLR P3.2
SETB P3.3
MOV P2,R6
ACALL DELAY
CLR P3.3
RET

DELAY:
MOV TMOD,#01
MOV TL0,#0AH
MOV TH0,#0FFH
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
RET
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top