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.

Help me with digital clock with time and date

Status
Not open for further replies.

eng.zooma

Newbie level 5
Joined
Dec 9, 2011
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Cairo,Egypt
Activity points
1,381
this program have to select and adjust time and date
i set up the time right but i can't do the date thing
any help here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
INCLUDE 8051.mc
rs EQU p0.0
rw EQU p0.1
e EQU p0.2
MOV R3,#0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV A,#38h ; intializing 5*7 Matrix
call command
MOV A,#0eh ; cursor on
call command
MOV A,#01h ; clear desplay
call command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LCD code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; writing long words
start5:
MOV R7,#12h
start4:

start3:
MOV A,#0c2h
call command
MOV A,R7
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R7
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#0c4h
call command
MOV A,#":"
call DATA
start2:
MOV R6,#00h
start1:
MOV R3,#0
start:
MOV A,#082h
call command
MOV A,R2
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R2
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#":"
call DATA
;;;;;;;;;;;;;;;;;;;;;;;
MOV A,R1
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R1
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#":"
call DATA
;;;;;;;;;;;;;;;;;;;;;;
MOV A,R0
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R0
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#":"
call DATA

;;;;;;;;;;;;;;;;;;
MOV A,#0c2h
call command
MOV A,R7
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R7
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#":"
call DATA
;;;;;;;;;;;;;;;;;;;
MOV A,R6
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R6
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,#":"
call DATA
;;;;;;;;;;;;;;;;;
MOV A,R3
CJNE A,#60h,cont
MOV R3,#0
INC R6
CJNE R6,#5Ah,start1
MOV R6,#00
MOV A,R7
CJNE A,#12h,cont1
MOV R7,#1
MOV A,#0c2h
call command
MOV A,R7
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R7
ANL A,#0fh
ADD A,#30h
call DATA
JMP start4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cont1:
INC R7
JMP start3
START7:
JMP start
cont:
MOV A,#0c8h
call command
MOV A,R3
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R3
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R3
ADD A,#1
DA A
MOV R3,A
call delay
JNB P1.0,min
JMP start
;;;;;;;;;;;;;;;;;;;;;;;;;;
day:
call delay
JNB p1.0,month
call delay
JNB p1.2,dayinc
call delay
JMP day
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
month:
call delay
JNB p1.0,year
call delay
JNB p1.2,monthinc
call delay
JMP month
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
year:
call delay
JNB p1.0,START7
call delay
JNB p1.2,yearinc
call delay
JMP year
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
hour:
call delay
JNB P1.0,day
call delay
call delay
JNB P1.2,hourinc
CALL DELAY
JMP hour
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
min:
call delay
JNB P1.2,mininc
call delay
JNB P1.0,hour
JMP min
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
delay:
MOV R5,#255
aaa:
MOV R4,#255
bbb:
NOP
DJNZ R4,bbb
DJNZ R5,aaa
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dayinc:
MOV p2,#088h
call command
MOV A,R0
ADD A,#1
DA A
MOV R0,A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R0
ANL A,#0fh
ADD A,#30h
call DATA
CJNE R0,#30h,day
MOV R0,#0
JMP day
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
monthinc:
MOV p2,#085h
call command
MOV A,R1
ADD A,#1
DA A
MOV R1,A
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R1
ANL A,#0fh
ADD A,#30h
call DATA
CJNE R1,#12h,month
MOV R1,#0
JMP month
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
yearinc:
MOV A,#082h
call command
MOV A,R2
ADD A,#1
DA A
MOV R2,A
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R2
ANL A,#0fh
ADD A,#30h
call DATA
JMP year
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mininc:
MOV A,#0c5h
call command
MOV A,R6
ADD A ,#1
DA A
MOV R6,A
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R6
ANL A,#0fh
ADD A,#30h
call DATA
CJNE R6,#59h,min
MOV R6,#0
JMP min
;;;;;;;;;;;;;;;;;;;;;;;
hourinc:
MOV A,#0c2h
call command
CJNE R7,#12h,continue
MOV R7,#0
continue:
MOV A,R7
ADD A,#1
DA A
MOV R7,A
CJNE R7,#14h,cont7
MOV R7,#1
cont7:
MOV A,R7
SWAP A
ANL A,#0fh
ADD A,#30h
call DATA
MOV A,R7
ANL A,#0fh
ADD A,#30h
call DATA

JMP hour
;;;;;;;;;;;;;;;;;;;;
command:
MOV p2,A
CLR rs
CLR rw
SETB e
call delay
CLR e
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;
data:
MOV p2,A
SETB rs
CLR rw
SETB e
call delay
CLR e
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
Last edited:

I would have though from reading the comments in the source code it was pretty obvious what is wrong. (I'm being sarcastic)

Brian.
 

i wish i have the ability to comprehend assembly language unfortunately i cant. but ill leave a link that may help your work more easier.
DS1307 + PIC16F877A | PIC Microcontroller Note
its a c programming , Mikro C, pic16f877a based microchip, and a real time clock used in laptops, computers, ds1307

unfortunately i have to use Assembly , but thx for your help dude

---------- Post added at 01:18 ---------- Previous post was at 01:17 ----------

@betwixt
hahaha, me to dude
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top