Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a digital clock display using Common Cathode 7-segment display modules an

ID: 2990211 • Letter: D

Question

Design a digital clock display using Common Cathode 7-segment display modules and a mode switch. The clock, normally displays the time in hh-mm-ss format. It updates the time automatically using the timer interrupt of the microcontroller. On pressing the mode switch, the display changes to date in dd-mm-yy format. On pressing the button once more, the display returns to show time. use 6 seven segmant displays. The hardrware part i can take care! plz provide me with the program use external inteerupt0 , you have to send the seven segment code itself and i am not using any seven segment decoders. Use multiplexing for led displays

Explanation / Answer

ORG 0000H
LJMP MAIN

ORG 001BH   ;vector address of interrupt 0
LJMP UPDATE


MAIN:   MOV R1,#14 ;YEAR
   MOV R6,#08 ;MONTH
   MOV R7,#18 ;DAY
   MOV R2,#00H ;COUNTER FOR SECONDS
   MOV R3,#00 ;SECONDS
   MOV R4,#29 ;MINUTES
   MOV R5,#19 ;HOURS
  
   MOV TMOD,#12H ;TIMER1 MODE 2, TIMER0 MODE 2
   MOV TL1,#0C9H
   MOV TH1,#7DH
   MOV IE,#88H    ;ENABLE GLOBAL AND TIMER1 INERRUPT

   SETB TR1     ;START TIMER1
  
BACK:
   MOV A,R5
   MOV B,#10
   DIV AB
   MOV DPTR,#0800H             ;MSB OF HOUR
   MOVC A,@A+DPTR
   MOV P1,#1FH
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H
   MOVC A,@A+DPTR       ;LSB OF HOUR
   MOV P1,#2FH
   MOV P2,A
   LCALL DELAY

   MOV A,R4
   MOV B,#10
   DIV AB
   MOV DPTR,#0800H       ;MSB OF MINUTES
   MOVC A,@A+DPTR
   MOV P1,#37H
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H
   MOVC A,@A+DPTR
   MOV P1,#3BH       ;LSB OF MINUTES
   MOV P2,A
   LCALL DELAY
  
   MOV A,R3
   MOV B,#10
   DIV AB           ;MSB OF SECONDS
   MOV DPTR,#0800H
   MOVC A,@A+DPTR
   MOV P1,#3DH
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H       ;LSB OF SECONDS
   MOVC A,@A+DPTR
   MOV P1,#3EH
   MOV P2,A
   LCALL DELAY

   JNB P3.0,STAY
   SJMP BACK
  
   STAY:JNB P3.0,STAY     ;WAIT FOR KEY DE-BOUNCING, TILL KEY OPENS AFTER PRESSING
  
DATE:   MOV A,R7
   MOV B,#10
   DIV AB
   MOV DPTR,#0800H             ;MSB OF DAY
   MOVC A,@A+DPTR
   MOV P1,#1FH
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H
   MOVC A,@A+DPTR       ;LSB OF DAY
   MOV P1,#2FH
   MOV P2,A
   LCALL DELAY

   MOV A,R6
   MOV B,#10
   DIV AB
   MOV DPTR,#0800H       ;MSB OF MONTH
   MOVC A,@A+DPTR
   MOV P1,#37H
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H
   MOVC A,@A+DPTR
   MOV P1,#3BH       ;LSB OF MONTH
   MOV P2,A
   LCALL DELAY
  
   MOV A,R1
   MOV B,#10
   DIV AB           ;MSB OF YEAR
   MOV DPTR,#0800H
   MOVC A,@A+DPTR
   MOV P1,#3DH
   MOV P2,A
   LCALL DELAY
  
   MOV A,B
   MOV DPTR,#0800H       ;LSB OF YEAR
   MOVC A,@A+DPTR
   MOV P1,#3EH
   MOV P2,A
   LCALL DELAY
  
   JNB P3.0,TIME       ;CHECK FOr KEY PRESS
   SJMP DATE    
  
TIME:   JNB P3.0,TIME       ;WAIT FOR KEY DEBOUNCING
   LJMP BACK


ORG 0300H
DELAY:
        MOV TL0,#34H
        MOV TH0,#0B4H
        SETB TR0
ONESECOND_3:JNB TF0,ONESECOND_3
        CLR TR0
        CLR TF0
        RET
      
ORG 0310H
UPDATE: CLR TR1
   INC R2
   CJNE R2,#15,NEXT
   INC R3
   MOV R2,#0
   CJNE R3,#60,NEXT
   INC R4
   MOV R3,#0
   CJNE R4,#60,NEXT
   INC R5
   MOV R4,#0
   CJNE R5,#24,NEXT
   MOV R5,#0
   LCALL CALENDAR
  
NEXT: MOV TL1,#0FCH
   MOV TH1,#0FH
   SETB TR1
   RETI
  
ORG 400H
CALENDAR: INC R7
       CJNE R7,#32,NOUPDATE
        INC R6
       MOV R7,#01
       CJNE R6,#13,NOUPDATE
       INC R1
       MOV R6,#01
       CJNE R1,#100,NOUPDATE
       MOV R1,#0
NOUPDATE: RET

ORG 0800H
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
END

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote