4 digit seven segment display showing time in seconds

Status
Not open for further replies.

swedha

Newbie level 3
Joined
Aug 23, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
hai,
i am doing my project,please help me in writing a program in both assembly language and in c language to continuously run microcontroller 8051 as a timer in seconds and display time in seconds using 4 digit seven segment display so that it can view from 0 to 9999 seconds.
please.....
 

Is this your home work?

There is a lot of examples available in the net. Search using google.
 

i have written assembly language program to run the timer but i donot know to display the seconds 4 digit 7 segment display.
i also need the same in c language.But i didnot get the suitable one in google.
 

code to run 8051 as timer:
org ooooh
seconds EQU 07Eh
crystal EQU 11059200
Timecycle EQU 12
TMR_SEC EQU crystal/timecycle
mov TMOD,#01h
mov seconds,#00h
again:mov ticks,#14h
loop:mov TH1=#4ch
mov TL1,#00h
SETB TR1
wait:JNB TF1,wait
CLR TF1
CLR TR1
DJNZ ticks,loop
INC seconds
RET again



now i am trying out with simulator only.
 

before starting a code start with algorithms or flowchart etc. for using 4 seven segment, u may require to use timer in interupt which is a bit complicated and before transmiting data to seven segment a code table has to be formed
that depends in what way you have connected the seven segment.

Code:
org 0h
 CALL INIT

AGAIN:
MOV A,R2
MOV P1,A     
CALL DELAY
INC R2
CJNE R2,#10,AGAIN
MOV R2,#0

JMP AGAIN

INIT:
     MOV TMOD,#11H
	MOV R2,#0

RET
DELAY:
        MOV R7,#10D
	L2: MOV R6,#100D
L1:
	CALL DEL
	DJNZ R6,L1
	DJNZ R7,L2
RET
 
DEL:
	MOV TL1,#7CH
	MOV TH1,#0FCH	
	SETB TR1
	JNB TF1,$
	CLR TR1
	CLR TF1
RET;
 
Reactions: swedha

    swedha

    Points: 2
    Helpful Answer Positive Rating
thank u so much for your reply.
i found this useful.i will try the program and if i have any doubt i will post
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…