Sei sulla pagina 1di 35

DIGITAL CLOCK

INTRODUCTION
EMU 8086 is a microprocessor emulator with an integrated 8086 Assembler. The emulator
can run programs on a Virtual Machine, and emulate real hardware including screen,
memory, and input and output devices. It helps you program in assembly language. The
source code is compiled by assembler and then executed on Emulator step-by-step, allowing
you to watch registers, flags and memory while your program runs.

A number of programs can be written in this useful emulator. In my project, I have written a
program on digital clock .

Design a microprocessor based digital clock .


Step 1: Start the program.

Step 2: Load seconds, minutes and hours in the memory.

Step 3: Display hours, minutes and seconds.

Step 4: Convert time information into Hex. format from decimal.

Step 5: Call delay routine for exactly one second.

Step 6 : Go to step 3.

Step 7: stop the program.

ASSUMPTIONS
 Clock frequency of the processor is assumed to be 5 MHz.

 As soon as the user enters stop , it is started again.

 Database stores previous time and balance in the form of digits in seven
segment code..

The hours, minutes, and seconds are entered at the memory locations

which is in decimal form. The enetered data is converted into the format from

decimal. A delay of exactly one second is generated and after each delay, the

seconds, minutes and hours information is updated. The processing of data is

done in hex. form and converted back into decimal before displaying

HARDWARE SPECIFICATIONS

Sr. no. Hardware Component Type Quantity

1. Microprocessor INTEL 8086 1

2. Octal D-type positive edge triggred flip flops with 74LS273 2


clear
3. 3V/5V Operation Static RAM (2Kx8bit) 2015 2

4. Bidirectional Buffer 74LS245 2

5. Programmable Pheripheral Interface with 24 I/O 8255A 1


lines

6. 4 to 16 line decoder/multiplexer 74154 1

7. Red, 4 digit ,Seven Segment cathode Display 7SEG-MPX4- 1


CC

8. Logic Gates Several

9. Number keypad - 1

ABOUT THE CODE:


We have made our program in EMU 8086.As the name suggests the project aims at detecting
time already mentioned in the code.

Three digits display.

Facility of lap timing which stores the time at which the user presses the switch and display it
when needed.

Can be switched between clock mode and stopwatch mode.

The following types of instructions have been used in the program:


1) Data Copy/Transfer Instructions : MOV

2) Arithmetic Instructions : CMP , INC

3) Branch Instructions : INT , JMP , JNE , LOOP

4) Assembler Directives and Operators : DB , END, LABEL

 Various registers like ax, bx , cx etc have also been used to make the code easy and
understandable .

 The detailed analysis of the code will be provided by a flowchart below.

 The project implements software real time clock using a timer.

Circuit Diagram and Interfacing


FLOW CHART

CODE
line level source
1 #include<reg51.h>

2 #include<string.h>

3 #define lcd P3

4 sbit rs=P2^0;

5 sbit e=P2^1;

7 sbit c=P0^0;

8 sbit d=P0^1;

10 void delay (int);

11 void cmd (unsigned char);

12 void display (unsigned char);

13 void string (char *);

14 void init (void);

15

16 void i2c_start (void);

17 void i2c_stop (void);

18 void i2c_write (unsigned char);

19 unsigned char i2c_read (void);

20 void i2c_ack (void);

21 void i2c_noack (void);

22 void write (unsigned char, unsigned char, unsigned char);

23 unsigned char read (unsigned char, unsigned char);

24 void set_time (unsigned char, unsigned char, unsigned char);

25

26

27 int no[10]={48,49,50,51,52,53,54,55,56,57};

28 unsigned int temp1[3]=0;

29

30 void delay (int d)

31 {

32 1 unsigned char i=0;

33 1 for(;d>0;d--)
34 1 {

35 2 for(i=250;i>0;i--);

36 2 for(i=248;i>0;i--);

37 2 }

38 1 }

39

40 void cmd (unsigned char c)

41 {

42 1 lcd=c;

43 1 rs=0;

44 1 e=1;

45 1 delay(5);

46 1 e=0;

47 1 }

48 void display (unsigned char c)

49 {

50 1 lcd=c;

51 1 rs=1;

52 1 e=1;

53 1 delay(5);

54 1 e=0;

55 1 }
C51 COMPILER V9.59.0.0 HELLO

56 void string (char *p)

57 {

58 1 while(*p)

59 1 {

60 2 display(*p++);

61 2 }

62 1 }

63 void init (void)

64 {

65 1 cmd(0x38);

66 1 cmd(0x0c);

67 1 cmd(0x01);

68 1 cmd(0x80);

69 1 }

70

71

72 void i2c_start (void)

73 {

74 1 c=1;

75 1 d=1;

76 1 delay(1);

77 1 d=0;

78 1 delay(1);

79 1 }

80

81 void i2c_stop (void)

82 {

83 1 c=0;

84 1 delay(1);

85 1 d=0;

86 1 delay(1);

87 1 c=1;
88 1 delay(1);

89 1 d=1;

90 1 delay(1);

91 1 }

92 void i2c_write (unsigned char a)

93 {

94 1 char j;

95 1 for(j=0;j<8;j++)

96 1 {

97 2 c=0;

98 2 d=(a&0x80>>j)?1:0;

99 2 c=1;

100 2 }

101 1 }

102 unsigned char i2c_read (void)

103 {

104 1 char j;

105 1 unsigned char temp=0;

106 1 for(j=0;j<8;j++)

107 1 {

108 2 c=0;

109 2 if(d)

110 2 temp=temp|(0x80>>j);

111 2 c=1;

112 2 }

113 1 return temp;

114 1 }

115 void i2c_ack (void)

116 {

117 1 c=0;
C51 COMPILER V9.59.0.

118 1 delay(1);

119 1 d=1;

120 1 delay(1);

121 1 c=1;

122 1 delay(1);

123 1 while(d==1);

124 1 c=0;

125 1 delay(1);

126 1 }

127 void i2c_noack (void)

128 {

129 1 c=0;

130 1 delay(1);

131 1 d=1;

132 1 delay(1);

133 1 c=1;

134 1 delay(1);

135 1

136 1 }

137

138 void write (unsigned char sa, unsigned char w_addr, unsigned char dat)

139 {

140 1 i2c_start();

141 1 i2c_write(sa);

142 1 i2c_ack();

143 1 i2c_write(w_addr);

144 1 i2c_ack();

145 1 i2c_write(dat);

146 1 i2c_ack();

147 1 i2c_stop();

148 1 delay(10);

149 1 }
150 unsigned char read (unsigned char sa, unsigned char w_addr)

151 {

152 1 unsigned char buf=0;

153 1 i2c_start();

154 1 i2c_write(sa);

155 1 i2c_ack();

156 1 i2c_write(w_addr);

157 1 i2c_ack();

158 1 i2c_start();

159 1 i2c_write(sa|0x01);

160 1 i2c_ack();

161 1 buf=i2c_read();

162 1 i2c_noack();

163 1 i2c_stop();

164 1 return buf;

165 1 }

166 void set_time (unsigned char hour, unsigned char min, unsigned char sec)

167 {

168 1 unsigned int temp[3];

169 1 temp[0]=(((unsigned char)(sec/10))<<4)|((unsigned char)(sec%10));

170 1 temp[1]=(((unsigned char)(min/10))<<4)|((unsigned char)(min%10));

171 1 temp[2]=(((unsigned char)(hour/10))<<4)|((unsigned char)(hour%10));

172 1 write(0xd0,0x00,temp[0]);

173 1 write(0xd0,0x01,temp[1]);

174 1 write(0xd0,0x02,temp[2]);

175 1 }

176

177

178 void main()

179 {
C51 COMPILER V9.59.0.0 HELLO

180 1 unsigned char temp=0;

181 1 init();

182 1 string(" Digital Clock ");

183 1 cmd(0xc0);

184 1 string(" using 8086 ");

185 1

186 1 delay(3000);

187 1 cmd(0x01);

188 1 set_time(12,59,51);

189 1 delay(500);

190 1 while(1)

191 1 {

192 2 cmd(0x80);

193 2 temp=read(0xd0,0x00);

194 2 temp1[0]=((temp&0x7F)>>4)*10 + (temp&0x0F);

195 2 temp=read(0xd0,0x01);

196 2 temp1[1]=(temp>>4)*10 + (temp&0x0F);

197 2 temp=read(0xd0,0x02);

198 2 temp1[2]=(temp>>4)*10 + (temp&0x0F);

199 2

200 2 display(no[(temp1[2]/10)%10]);

201 2 display(no[temp1[2]%10]);

202 2 display(':');

203 2 display(no[(temp1[1]/10)%10]);

204 2 display(no[temp1[1]%10]);

205 2 display(':');

206 2 display(no[(temp1[0]/10)%10]);

207 2 display(no[temp1[0]%10]);

208 2

209 2 }

210 1 while(1);

211 1 }
C51 COMPILER V9.59.0.0 HELLO

ASSEMBLY LISTING OF GENERATED OBJECT CODE

; FUNCTION L?0051 (BEGIN)

0000 C280 CLR c

0002 7F01 MOV R7,#01H

0004 7E00 MOV R6,#00H

0006 120000 R LCALL _delay

0009 L?0052:

0009 D281 SETB d

000B L?0053:

000B 7F01 MOV R7,#01H

000D 7E00 MOV R6,#00H

; FUNCTION _delay (BEGIN)

; SOURCE LINE # 30

;---- Variable 'd' assigned to Register 'R6/R7' ----

; SOURCE LINE # 31

; SOURCE LINE # 32

;---- Variable 'i' assigned to Register 'R5' ----

; SOURCE LINE # 33

000F ?C0001:

000F D3 SETB C

0010 EF MOV A,R7

0011 9400 SUBB A,#00H

0013 EE MOV A,R6

0014 6480 XRL A,#080H

0016 9480 SUBB A,#080H

0018 4025 JC ?C0010

; SOURCE LINE # 34

; SOURCE LINE # 35

001A 7DFA MOV R5,#0FAH

001C ?C0004:
001C ED MOV A,R5

001D D3 SETB C

001E 9400 SUBB A,#00H

0020 7480 MOV A,#080H

0022 9480 SUBB A,#080H

0024 4003 JC ?C0005

0026 1D DEC R5

0027 80F3 SJMP ?C0004

0029 ?C0005:

; SOURCE LINE # 36

0029 7DF8 MOV R5,#0F8H

002B ?C0007:

002B ED MOV A,R5

002C D3 SETB C

002D 9400 SUBB A,#00H

002F 7480 MOV A,#080H

0031 9480 SUBB A,#080H

0033 4003 JC ?C0003

0035 1D DEC R5

0036 80F3 SJMP ?C0007

; SOURCE LINE # 37

0038 ?C0003:

0038 EF MOV A,R7

0039 1F DEC R7

003A 70D3 JNZ ?C0001

003C 1E DEC R6

003D ?C0042:

003D 80D0 SJMP ?C0001

; SOURCE LINE # 38

003F ?C0010:
C51 COMPILER V9.59.0.0 HELLO

003F 22 RET

; FUNCTION _delay (END)

; FUNCTION _cmd (BEGIN)

; SOURCE LINE # 40

;---- Variable 'c' assigned to Register 'R7' ----

; SOURCE LINE # 41

; SOURCE LINE # 42

0000 8FB0 MOV P3,R7

; SOURCE LINE # 43

0002 C2A0 CLR rs

; SOURCE LINE # 44

0004 D2A1 SETB e

; SOURCE LINE # 45

0006 7F05 MOV R7,#05H

0008 7E00 MOV R6,#00H

000A 120000 R LCALL _delay

; SOURCE LINE # 46

000D C2A1 CLR e

; SOURCE LINE # 47

000F 22 RET

; FUNCTION _cmd (END)

; FUNCTION L?0048 (BEGIN)

0000 7C00 MOV R4,#00H

0002 L?0049:

0002 7D0A MOV R5,#0AH

0004 120000 E LCALL ?C?UIDIV

0007 L?0050:

0007 7C00 MOV R4,#00H

0009 7D0A MOV R5,#0AH

000B 120000 E LCALL ?C?UIDIV


000E ED MOV A,R5

000F 25E0 ADD A,ACC

0011 2400 R ADD A,#LOW no

0013 F8 MOV R0,A

0014 08 INC R0

0015 E6 MOV A,@R0

0016 FF MOV R7,A

; FUNCTION _display (BEGIN)

; SOURCE LINE # 48

;---- Variable 'c' assigned to Register 'R7' ----

; SOURCE LINE # 49

; SOURCE LINE # 50

0017 8FB0 MOV P3,R7

; SOURCE LINE # 51

0019 D2A0 SETB rs

; SOURCE LINE # 52

001B D2A1 SETB e

; SOURCE LINE # 53

001D 7F05 MOV R7,#05H

001F 7E00 MOV R6,#00H

0021 120000 R LCALL _delay

; SOURCE LINE # 54

0024 C2A1 CLR e

; SOURCE LINE # 55

0026 22 RET

; FUNCTION _display (END)

; FUNCTION _string (BEGIN)

; SOURCE LINE # 56

0000 8B00 R MOV p,R3


C51 COMPILER V9.59.0.0 HELLO

0002 8A00 R MOV p+01H,R2

0004 8900 R MOV p+02H,R1

; SOURCE LINE # 57

0006 ?C0013:

; SOURCE LINE # 58

0006 AB00 R MOV R3,p

0008 AA00 R MOV R2,p+01H

000A A900 R MOV R1,p+02H

000C 120000 E LCALL ?C?CLDPTR

000F 6013 JZ ?C0015

; SOURCE LINE # 59

; SOURCE LINE # 60

0011 0500 R INC p+02H

0013 E500 R MOV A,p+02H

0015 7002 JNZ ?C0043

0017 0500 R INC p+01H

0019 ?C0043:

0019 14 DEC A

001A F9 MOV R1,A

001B 120000 E LCALL ?C?CLDPTR

001E FF MOV R7,A

001F 120000 R LCALL _display

; SOURCE LINE # 61

0022 80E2 SJMP ?C0013

; SOURCE LINE # 62

0024 ?C0015:

0024 22 RET

; FUNCTION _string (END)

; FUNCTION init (BEGIN)

; SOURCE LINE # 63

; SOURCE LINE # 64
; SOURCE LINE # 65

0000 7F38 MOV R7,#038H

0002 120000 R LCALL _cmd

; SOURCE LINE # 66

0005 7F0C MOV R7,#0CH

0007 120000 R LCALL _cmd

; SOURCE LINE # 67

000A 7F01 MOV R7,#01H

000C 120000 R LCALL _cmd

; SOURCE LINE # 68

000F 7F80 MOV R7,#080H

0011 020000 R LJMP _cmd

; FUNCTION init (END)

; FUNCTION i2c_start (BEGIN)

; SOURCE LINE # 72

; SOURCE LINE # 73

; SOURCE LINE # 74

0000 D280 SETB c

; SOURCE LINE # 75

; SOURCE LINE # 76

0002 120000 R LCALL L?0052

; SOURCE LINE # 77

0005 C281 CLR d

; SOURCE LINE # 78

0007 7F01 MOV R7,#01H

0009 7E00 MOV R6,#00H

000B 020000 R LJMP _delay

; FUNCTION i2c_start (END)


C51 COMPILER V9.59.0.0 HELLO

; FUNCTION i2c_stop (BEGIN)

; SOURCE LINE # 81

; SOURCE LINE # 82

; SOURCE LINE # 83

0000 C280 CLR c

; SOURCE LINE # 84

0002 120000 R LCALL L?0053

; SOURCE LINE # 85

0005 C281 CLR d

; SOURCE LINE # 86

0007 120000 R LCALL L?0053

; SOURCE LINE # 87

000A D280 SETB c

; SOURCE LINE # 88

000C 120000 R LCALL L?0053

; SOURCE LINE # 89

000F D281 SETB d

; SOURCE LINE # 90

0011 7F01 MOV R7,#01H

0013 7E00 MOV R6,#00H

0015 020000 R LJMP _delay

; FUNCTION i2c_stop (END)

; FUNCTION _i2c_write (BEGIN)

; SOURCE LINE # 92

;---- Variable 'a' assigned to Register 'R5' ----

0000 AD07 MOV R5,AR7

; SOURCE LINE # 93

; SOURCE LINE # 95

;---- Variable 'j' assigned to Register 'R4' ----

0002 E4 CLR A

0003 FC MOV R4,A


0004 ?C0019:

0004 EC MOV A,R4

0005 FF MOV R7,A

0006 33 RLC A

0007 95E0 SUBB A,ACC

0009 FE MOV R6,A

000A C3 CLR C

000B EF MOV A,R7

000C 9408 SUBB A,#08H

000E EE MOV A,R6

000F 6480 XRL A,#080H

0011 9480 SUBB A,#080H

0013 5025 JNC ?C0024

; SOURCE LINE # 96

; SOURCE LINE # 97

0015 C280 CLR c

; SOURCE LINE # 98

0017 7E00 MOV R6,#00H

0019 7480 MOV A,#080H

001B A804 MOV R0,AR4

001D 08 INC R0

001E 8006 SJMP ?C0045

0020 ?C0044:

0020 CE XCH A,R6

0021 A2E7 MOV C,ACC.7

0023 13 RRC A

0024 CE XCH A,R6

0025 13 RRC A

0026 ?C0045:

0026 D8F8 DJNZ R0,?C0044


C51 COMPILER V9.59.0.0 HELLO

0028 FF MOV R7,A

0029 ED MOV A,R5

002A FB MOV R3,A

002B EF MOV A,R7

002C 5B ANL A,R3

002D 6003 JZ ?C0022

002F D3 SETB C

0030 8001 SJMP ?C0023

0032 ?C0022:

0032 C3 CLR C

0033 ?C0023:

0033 9281 MOV d,C

; SOURCE LINE # 99

0035 D280 SETB c

; SOURCE LINE # 100

0037 0C INC R4

0038 80CA SJMP ?C0019

; SOURCE LINE # 101

003A ?C0024:

003A 22 RET

; FUNCTION _i2c_write (END)

; FUNCTION i2c_read (BEGIN)

; SOURCE LINE # 102

; SOURCE LINE # 103

; SOURCE LINE # 105

;---- Variable 'temp' assigned to Register 'R7' ----

0000 E4 CLR A

0001 FF MOV R7,A

; SOURCE LINE # 106

;---- Variable 'j' assigned to Register 'R6' ----

0002 FE MOV R6,A


0003 ?C0025:

0003 EE MOV A,R6

0004 FD MOV R5,A

0005 33 RLC A

0006 95E0 SUBB A,ACC

0008 FC MOV R4,A

0009 C3 CLR C

000A ED MOV A,R5

000B 9408 SUBB A,#08H

000D EC MOV A,R4

000E 6480 XRL A,#080H

0010 9480 SUBB A,#080H

0012 5017 JNC ?C0026

; SOURCE LINE # 107

; SOURCE LINE # 108

0014 C280 CLR c

; SOURCE LINE # 109

0016 30810D JNB d,?C0028

; SOURCE LINE # 110

0019 A806 MOV R0,AR6

001B 7480 MOV A,#080H

001D 08 INC R0

001E 8002 SJMP ?C0047

0020 ?C0046:

0020 C3 CLR C

0021 13 RRC A

0022 ?C0047:

0022 D8FC DJNZ R0,?C0046

0024 4207 ORL AR7,A

0026 ?C0028:
C51 COMPILER V9.59.0.0 HELLO

; SOURCE LINE # 111

0026 D280 SETB c

; SOURCE LINE # 112

0028 0E INC R6

0029 80D8 SJMP ?C0025

002B ?C0026:

; SOURCE LINE # 113

; SOURCE LINE # 114

002B 22 RET

; FUNCTION i2c_read (END)

; FUNCTION L?0054 (BEGIN)

0000 120000 R LCALL _i2c_write

0003 120000 R LCALL i2c_ack

0006 AF01 MOV R7,AR1

0008 120000 R LCALL _i2c_write

; FUNCTION i2c_ack (BEGIN)

; SOURCE LINE # 115

; SOURCE LINE # 116

; SOURCE LINE # 117

; SOURCE LINE # 118

; SOURCE LINE # 119

; SOURCE LINE # 120

000B 120000 R LCALL L?0051

; SOURCE LINE # 121

000E D280 SETB c

; SOURCE LINE # 122

0010 120000 R LCALL L?0053

0013 ?C0030:

; SOURCE LINE # 123

0013 2081FD JB d,?C0030

; SOURCE LINE # 124


0016 C280 CLR c

; SOURCE LINE # 125

0018 7F01 MOV R7,#01H

001A 7E00 MOV R6,#00H

001C 020000 R LJMP _delay

; FUNCTION i2c_ack (END)

; FUNCTION i2c_noack (BEGIN)

; SOURCE LINE # 127

; SOURCE LINE # 128

; SOURCE LINE # 129

; SOURCE LINE # 130

; SOURCE LINE # 131

; SOURCE LINE # 132

0000 120000 R LCALL L?0051

; SOURCE LINE # 133

0003 D280 SETB c

; SOURCE LINE # 134

0005 7F01 MOV R7,#01H

0007 7E00 MOV R6,#00H

0009 020000 R LJMP _delay

; FUNCTION i2c_noack (END)

; FUNCTION _write (BEGIN)

; SOURCE LINE # 138

;---- Variable 'sa' assigned to Register 'R4' ----

0000 AC07 MOV R4,AR7

;---- Variable 'dat' assigned to Register 'R2' ----

0002 AA03 MOV R2,AR3

;---- Variable 'w_addr' assigned to Register 'R1' ----


C51 COMPILER V9.59.0.0 HELLO

0004 A905 MOV R1,AR5

; SOURCE LINE # 139

; SOURCE LINE # 140

0006 120000 R LCALL i2c_start

; SOURCE LINE # 141

0009 AF04 MOV R7,AR4

; SOURCE LINE # 142

; SOURCE LINE # 143

; SOURCE LINE # 144

000B 120000 R LCALL L?0054

; SOURCE LINE # 145

000E AF02 MOV R7,AR2

0010 120000 R LCALL _i2c_write

; SOURCE LINE # 146

0013 120000 R LCALL i2c_ack

; SOURCE LINE # 147

0016 120000 R LCALL i2c_stop

; SOURCE LINE # 148

0019 7F0A MOV R7,#0AH

001B 7E00 MOV R6,#00H

001D 020000 R LJMP _delay

; FUNCTION _write (END)

; FUNCTION _read (BEGIN)

; SOURCE LINE # 150

;---- Variable 'sa' assigned to Register 'R2' ----

0000 AA07 MOV R2,AR7

;---- Variable 'w_addr' assigned to Register 'R1' ----

0002 A905 MOV R1,AR5

; SOURCE LINE # 151

; SOURCE LINE # 152

;---- Variable 'buf' assigned to Register 'R4' ----


0004 E4 CLR A

0005 FC MOV R4,A

; SOURCE LINE # 153

0006 120000 R LCALL i2c_start

; SOURCE LINE # 154

0009 AF02 MOV R7,AR2

; SOURCE LINE # 155

; SOURCE LINE # 156

; SOURCE LINE # 157

000B 120000 R LCALL L?0054

; SOURCE LINE # 158

000E 120000 R LCALL i2c_start

; SOURCE LINE # 159

0011 EA MOV A,R2

0012 4401 ORL A,#01H

0014 FF MOV R7,A

0015 120000 R LCALL _i2c_write

; SOURCE LINE # 160

0018 120000 R LCALL i2c_ack

; SOURCE LINE # 161

001B 120000 R LCALL i2c_read

001E AC07 MOV R4,AR7

; SOURCE LINE # 162

0020 120000 R LCALL i2c_noack

; SOURCE LINE # 163

0023 120000 R LCALL i2c_stop

; SOURCE LINE # 164

0026 AF04 MOV R7,AR4

; SOURCE LINE # 165

0028 22 RET
C51 COMPILER V9.59.0.0 HELLO

; FUNCTION _read (END)

; FUNCTION _set_time (BEGIN)

; SOURCE LINE # 166

;---- Variable 'hour' assigned to Register 'R1' ----

0000 A907 MOV R1,AR7

;---- Variable 'sec' assigned to Register 'R3' ----

;---- Variable 'min' assigned to Register 'R5' ----

; SOURCE LINE # 167

; SOURCE LINE # 169

0002 EB MOV A,R3

0003 75F00A MOV B,#0AH

0006 84 DIV AB

0007 75F010 MOV B,#010H

000A A4 MUL AB

000B FF MOV R7,A

000C AEF0 MOV R6,B

000E EB MOV A,R3

000F 75F00A MOV B,#0AH

0012 84 DIV AB

0013 E5F0 MOV A,B

0015 FB MOV R3,A

0016 EE MOV A,R6

0017 F500 R MOV temp,A

0019 EF MOV A,R7

001A 4B ORL A,R3

001B F500 R MOV temp+01H,A

; SOURCE LINE # 170

001D ED MOV A,R5

001E 75F00A MOV B,#0AH

0021 84 DIV AB

0022 75F010 MOV B,#010H


0025 A4 MUL AB

0026 FF MOV R7,A

0027 AEF0 MOV R6,B

0029 ED MOV A,R5

002A 75F00A MOV B,#0AH

002D 84 DIV AB

002E ADF0 MOV R5,B

0030 EE MOV A,R6

0031 F500 R MOV temp+02H,A

0033 EF MOV A,R7

0034 4D ORL A,R5

0035 F500 R MOV temp+03H,A

; SOURCE LINE # 171

0037 E9 MOV A,R1

0038 75F00A MOV B,#0AH

003B 84 DIV AB

003C 75F010 MOV B,#010H

003F A4 MUL AB

0040 FF MOV R7,A

0041 AEF0 MOV R6,B

0043 E9 MOV A,R1

0044 75F00A MOV B,#0AH

0047 84 DIV AB

0048 ADF0 MOV R5,B

004A EE MOV A,R6

004B F500 R MOV temp+04H,A

004D EF MOV A,R7

004E 4D ORL A,R5

004F F500 R MOV temp+05H,A

; SOURCE LINE # 172


C51 COMPILER V9.59.0.0 HELLO

0051 AB00 R MOV R3,temp+01H

0053 E4 CLR A

0054 FD MOV R5,A

0055 7FD0 MOV R7,#0D0H

0057 120000 R LCALL _write

; SOURCE LINE # 173

005A AB00 R MOV R3,temp+03H

005C 7D01 MOV R5,#01H

005E 7FD0 MOV R7,#0D0H

0060 120000 R LCALL _write

; SOURCE LINE # 174

0063 AB00 R MOV R3,temp+05H

0065 7D02 MOV R5,#02H

0067 7FD0 MOV R7,#0D0H

0069 020000 R LJMP _write

; FUNCTION _set_time (END)

; FUNCTION main (BEGIN)

; SOURCE LINE # 178

; SOURCE LINE # 179

; SOURCE LINE # 180

0000 E4 CLR A

0001 F500 R MOV temp,A

; SOURCE LINE # 181

0003 120000 R LCALL init

; SOURCE LINE # 182

0006 7BFF MOV R3,#0FFH

0008 7A00 R MOV R2,#HIGH ?SC_0

000A 7900 R MOV R1,#LOW ?SC_0

000C 120000 R LCALL _string

; SOURCE LINE # 183

000F 7FC0 MOV R7,#0C0H


0011 120000 R LCALL _cmd

; SOURCE LINE # 184

0014 7BFF MOV R3,#0FFH

0016 7A00 R MOV R2,#HIGH ?SC_17

0018 7900 R MOV R1,#LOW ?SC_17

001A 120000 R LCALL _string

; SOURCE LINE # 186

001D 7FB8 MOV R7,#0B8H

001F 7E0B MOV R6,#0BH

0021 120000 R LCALL _delay

; SOURCE LINE # 187

0024 7F01 MOV R7,#01H

0026 120000 R LCALL _cmd

; SOURCE LINE # 188

0029 7B33 MOV R3,#033H

002B 7D3B MOV R5,#03BH

002D 7F0C MOV R7,#0CH

002F 120000 R LCALL _set_time

; SOURCE LINE # 189

0032 7FF4 MOV R7,#0F4H

0034 7E01 MOV R6,#01H

0036 120000 R LCALL _delay

0039 ?C0037:

; SOURCE LINE # 190

; SOURCE LINE # 191

; SOURCE LINE # 192

0039 7F80 MOV R7,#080H

003B 120000 R LCALL _cmd

; SOURCE LINE # 193

003E E4 CLR A
C51 COMPILER V9.59.0.0 HELLO

003F FD MOV R5,A

0040 7FD0 MOV R7,#0D0H

0042 120000 R LCALL _read

0045 8F00 R MOV temp,R7

; SOURCE LINE # 194

0047 E500 R MOV A,temp

0049 547F ANL A,#07FH

004B C4 SWAP A

004C 540F ANL A,#0FH

004E 75F00A MOV B,#0AH

0051 A4 MUL AB

0052 FF MOV R7,A

0053 AEF0 MOV R6,B

0055 E500 R MOV A,temp

0057 540F ANL A,#0FH

0059 7C00 MOV R4,#00H

005B 2F ADD A,R7

005C F500 R MOV temp1+01H,A

005E EC MOV A,R4

005F 3E ADDC A,R6

0060 F500 R MOV temp1,A

; SOURCE LINE # 195

0062 7D01 MOV R5,#01H

0064 7FD0 MOV R7,#0D0H

0066 120000 R LCALL _read

0069 8F00 R MOV temp,R7

; SOURCE LINE # 196

006B E500 R MOV A,temp

006D C4 SWAP A

006E 540F ANL A,#0FH

0070 75F00A MOV B,#0AH

0073 A4 MUL AB
0074 FF MOV R7,A

0075 AEF0 MOV R6,B

0077 E500 R MOV A,temp

0079 540F ANL A,#0FH

007B 7C00 MOV R4,#00H

007D 2F ADD A,R7

007E F500 R MOV temp1+03H,A

0080 EC MOV A,R4

0081 3E ADDC A,R6

0082 F500 R MOV temp1+02H,A

; SOURCE LINE # 197

0084 7D02 MOV R5,#02H

0086 7FD0 MOV R7,#0D0H

0088 120000 R LCALL _read

008B 8F00 R MOV temp,R7

; SOURCE LINE # 198

008D E500 R MOV A,temp

008F C4 SWAP A

0090 540F ANL A,#0FH

0092 75F00A MOV B,#0AH

0095 A4 MUL AB

0096 FF MOV R7,A

0097 AEF0 MOV R6,B

0099 E500 R MOV A,temp

009B 540F ANL A,#0FH

009D 7C00 MOV R4,#00H

009F 2F ADD A,R7

00A0 F500 R MOV temp1+05H,A

00A2 EC MOV A,R4

00A3 3E ADDC A,R6


C51 COMPILER V9.59.0.0

00A4 F500 R MOV temp1+04H,A

; SOURCE LINE # 200

00A6 FE MOV R6,A

00A7 AF00 R MOV R7,temp1+05H

00A9 120000 R LCALL L?0049

; SOURCE LINE # 201

00AC AE00 R MOV R6,temp1+04H

00AE AF00 R MOV R7,temp1+05H

00B0 120000 R LCALL L?0050

; SOURCE LINE # 202

00B3 7F3A MOV R7,#03AH

00B5 120000 R LCALL _display

; SOURCE LINE # 203

00B8 AE00 R MOV R6,temp1+02H

00BA AF00 R MOV R7,temp1+03H

00BC 120000 R LCALL L?0048

; SOURCE LINE # 204

00BF AE00 R MOV R6,temp1+02H

00C1 AF00 R MOV R7,temp1+03H

00C3 120000 R LCALL L?0050

; SOURCE LINE # 205

00C6 7F3A MOV R7,#03AH

00C8 120000 R LCALL _display

; SOURCE LINE # 206

00CB AE00 R MOV R6,temp1

00CD AF00 R MOV R7,temp1+01H

00CF 120000 R LCALL L?0048

; SOURCE LINE # 207

00D2 AE00 R MOV R6,temp1

00D4 AF00 R MOV R7,temp1+01H

00D6 120000 R LCALL L?0050

; SOURCE LINE # 209


00D9 020000 R LJMP ?C0037

; FUNCTION main (END)

MODULE INFORMATION: STATIC OVERLAYABLE

CODE SIZE = 761 ----

CONSTANT SIZE = 34 ----

XDATA SIZE = ---- ----

PDATA SIZE = ---- ----

DATA SIZE = 26 10

IDATA SIZE = ---- ----

BIT SIZE = ---- ----

END OF MODULE INFORMATION.

APPLICATIONS
Because digital clocks can be very small and inexpensive devices that
enhance the popularity of product designs, they are often incorporated into all
kinds of devices such as cars, radios, televisions, microwave ovens, standard
ovens, computers and cell phones

FUTURE SCOPE
Apart from the security purpose , this logic now a days is used as a new concept .

REFERENCES
• www.free2code.net

• www.emu8086.com

Potrebbero piacerti anche