<meta name="keywords" content="必胜时时彩开户,keywords" /> 电子万年历-汇编法式模范(DS18B20温度网络、DS1302时钟、静态扫描显示、阴历转换) 联系我们

电子万年历-汇编法式模范模范(DS18B20温度搜集、DS1302时钟、静态扫描显示、阴历转换)



 

CONFIG12 EQU 7FH

  TEMPH EQU 21H

  TEMPL EQU 20H

  REG2 EQU 22H

  REG3 EQU 23H

  REG4 EQU 24H

  DAT EQU P0.7

  SCLK EQU P3.2

  IO  EQU P3.3

  RST EQU P3.4

  year DATA 66H

  month DATA 65H

  week DATA 64H

  day DATA 63H

  hour DATA 62H

  mintue DATA 61H

  second DATA 60H

 

  ORG 0000H

  LJMP START

  ORG 001BH

  LJMP INTT1

 

START:             ;初值

  LCALL ZJ

  SETB EA

  MOV SCON,#00H    ; 串行输入,要领0

  MOV TMOD,#10H    ;计数器1,要领1

  MOV TL1,#00H

  MOV TH1,#00H

  MOV 32H,#8EH

  MOV 31H,#00H     ;允许写1302

  LCALL WRITE

  MOV 32H,#90H

  MOV 31H,#0A6H   ;1302充电,充电电流1.1MA

  LCALL WRITE

  ;主法式模范模范~~~~~~~~~~~~~~~~~~~~~

MAIN1:

  MOV 32H,#8DH    ;读出年

  LCALL READ

  MOV year,31H

 

  MOV 32H,#8BH  ;读出星期

  LCALL READ

  MOV week,31H

 

  MOV 32H,#89H  ;读出月

  LCALL READ

  MOV month,31H

 

  MOV 32H,#87H ;读出日

  LCALL READ

  MOV day,31H

 

  MOV 32H,#85H ;读出小时

  LCALL READ

  MOV hour,31H

 

  MOV 32H,#83H ;读出分钟

  LCALL READ

  MOV mintue,31H

 

  MOV 32H,#81H ;读出秒

  LCALL READ

  MOV second,31H

  ;~~~~~~~~~~~~划分缓存~~~~~~~~

  MOV R0,year   ;年划分,送显示缓存

  LCALL DIVIDE

  MOV 7BH,R1

  MOV 4BH,R1

  MOV 7CH,R2

  MOV 4CH,R2

  MOV 78H,week

  MOV 48H,week

  MOV R0,month ;月划分,送显示缓存

  LCALL DIVIDE

  MOV 79H,R1

  MOV 49H,R1

  MOV 7AH,R2

  MOV 4AH,R2

  MOV R0,day  ;日划分,送显示缓存

  LCALL DIVIDE

  MOV 76H,R1

  MOV 46H,R1

  MOV 77H,R2

  MOV 47H,R2

  MOV R0,hour ;小时划分,送显示缓存

  LCALL DIVIDE

  MOV 74H,R1

  MOV 44H,R1

  MOV 75H,R2

  MOV 45H,R2

  MOV R0,mintue ;分钟划分,送显示缓存

  LCALL DIVIDE

  MOV 72H,R1

  MOV 42H,R1

  MOV 73H,R2

  MOV 43H,R2

  MOV R0,second ;秒划分,送显示缓存

  LCALL DIVIDE

  MOV 70H,R1

  MOV 40H,R1

  MOV 71H,R2

  MOV 41H,R2

  CLR EA

  LCALL TOUTOU

  SETB EA

  LCALL DISPLAY

  LCALL GENGXIAN    ;更新阴历法式模范模范

  JNB P0.1,SETG111

  JNB F0,SSS

  setb P0.4         ;非闰月,则p0.4清零,指导灯亮

  LJMP MAIN1

SETG111:

  LJMP SETG

SSS:

  clr P0.4  ;闰月,则p0.4置位,指导灯不亮

  LJMP MAIN1

 

;~~~~~~~~~~~~~~  温度

TOUTOU:

  LCALL CHUSHI

  LCALL RDTEMP

  MOV A,TEMPL

  ANL A,#11110000B

  MOV TEMPL,A

  MOV A,TEMPH

  ANL A,#00000111B

  ORL A,TEMPL

  SWAP A

  MOV 25H,A

  MOV A,25H

  MOV B,#64H

  DIV AB

  MOV A,B

  MOV B,#0AH

  DIV AB

  SWAP A

  ORL A,B

  MOV 10H,A

  RET

CHUSHI:

  LCALL RESET

  MOV A,#0CCH

  LCALL WRITE111

  MOV A,#4EH

  LCALL WRITE111

  MOV A,#CONFIG12

  LCALL WRITE111

  RET

RDTEMP:

  LCALL RESET

  MOV A,#0CCH

  LCALL WRITE111

  MOV A,#44H

  LCALL WRITE111

  LCALL DL1MS

  LCALL RESET

  MOV A,#0CCH

  LCALL WRITE111

  MOV A,#0BEH

  LCALL WRITE111

  LCALL ERAD111

  MOV TEMPL,A

  LCALL ERAD111

  MOV TEMPH,A

  RET

RESET:

LA:

  SETB DAT

  MOV 52H,#200

LB:

  CLR DAT

  DJNZ 52H,LB

  SETB DAT

  MOV 52H,#30

LC:

  DJNZ 52H,LC

  CLR C

  ORL C,DAT

  JC LB

  MOV 58H,#80

LD:

  ORL C,DAT

  JC LP

  DJNZ 58H,LD

  SJMP LA

LP:

  MOV 52H,#250

LF:

  DJNZ 52H,LF

  RET

WRITE111:

  MOV 53H,#8

W51HA:

  SETB DAT

  MOV 54H,#8

  RRC A

  CLR DAT

W52HA:

  DJNZ 54H,W52HA

  MOV DAT,C

  MOV 54H,#30

W53HA:

  DJNZ 54H,W53HA

  DJNZ 53H,W51HA

  SETB DAT

  RET

ERAD111:

  CLR EA

  MOV 58H,#8

RD1A:

  CLR DAT

  MOV 54H,#6

  NOP

  SETB DAT

RD2A:

  DJNZ 54H,RD2A

  MOV C,DAT

  RRC A

  MOV 55H,#30

RD3A:

  DJNZ 55H,RD3A

  DJNZ 58H,RD1A

  SETB DAT

  RET

 

;公历设置法式模范模范~~~~~~~~~~~~~~~~~~~~~

SETG :

  SETB TR1

  SETB ET1

  MOV 32H,#8EH

  MOV 31H,#00H      ;允许写1302

  LCALL WRITE

  MOV 32H,#80H

  MOV 31H,#80H      ;1302阻拦振荡

  LCALL WRITE

GWAIT:   ;~~~~~~~~~~~~~~~~~~

  LCALL DISPLAY

  JNB P0.1,GWAIT

SETG1:

  LCALL DISPLAY

  JNB P0.1,SETG2

  JNB P0.2,GADDYEAR

  JNB P0.3,JIANYEAR

  AJMP SETG1

GADDYEAR:

  MOV R7,66H      ;年加一

  LCALL ADD1

  MOV 66H,A

  CJNE A,#51H,GADDYEAR1

  MOV 66H,#00H

  AJMP GADDYEAR1

JIANYEAR:

  MOV R7,66H      ;年减一

  LCALL JIAN1

  MOV 66H,A

  CJNE A,#00H,GADDYEAR1

  MOV 66H,#51H

GADDYEAR1:

  MOV 32H,#8CH    ;年值送人1302

  MOV 31H,66H

  LCALL WRITE

  MOV R0,66H

  LCALL DIVIDE    ;年划分送显示缓存

  MOV 4BH,R1

  MOV 7BH,R1

  MOV 4CH,R2

  MOV 7CH,R2

WAITT1:     ;~~~~~~~~~~~~~~~~

  LCALL DISPLAY

  JNB P0.2,WAITT1

  JNB P0.3,WAITT1

  AJMP SETG1

SETG2:

  SETB 0AH         ;调月时闪标志

GWAIT2:

  LCALL DISPLAY

  JNB P0.1,GWAIT2

SETG3:

  LCALL DISPLAY

  JNB P0.1,SETG4

  JNB P0.2,GADDMONTH

  JNB P0.3,JIANMONTH

  AJMP SETG3

GADDMONTH:

  MOV R7,65H    ;月加一

  LCALL ADD1

  MOV 65H,A

  CJNE A,#13H,GADDMONTH1

  MOV 65H,#01H

  AJMP GADDMONTH1

JIANMONTH:

  MOV R7,65H    ;月减一

  LCALL JIAN1

  MOV 65H,A

  CJNE A,#00H,GADDMONTH1

  MOV 65H,#12H

GADDMONTH1:

  MOV 32H,#88H ;月值送人1302

  MOV 31H,65H

  LCALL WRITE

  MOV R0,65H

  LCALL DIVIDE ;月划分,送显示缓存

  MOV 79H,R1

  MOV 49H,R1

  MOV 7AH,R2

  MOV 4AH,R2

WAITT2:  ;~~~~~~~~~~~~~~~~~~~~

  LCALL DISPLAY

  JNB P0.2,WAITT2

  JNB P0.3,WAITT2

  AJMP SETG3

SETG4:

  SETB 0BH   ;调日时闪标志

GWAIT4:

  LCALL DISPLAY

  JNB P0.1,GWAIT4

SETG5:

  LCALL DISPLAY

  JNB P0.1,SETG6

  JNB P0.2,GADDDAY

  JNB P0.3,JIANDAY

  AJMP SETG5

GADDDAY:

  MOV R7,63H    ;日加一

  LCALL ADD1

  MOV 63H,A

  CJNE A,#32H,GADDDAY1

  MOV 63H,#01H

JIANDAY:

  MOV R7,63H    ;日减一

  LCALL JIAN1

  MOV 63H,A

  CJNE A,#00H,GADDDAY1

  MOV 63H,#31H

GADDDAY1:

  MOV 32H,#86H ;日值送人1302

  MOV 31H,63H

  LCALL WRITE

  MOV R0,63H

  LCALL DIVIDE ;日划分,送显示缓存

  MOV 76H,R1

  MOV 46H,R1

  MOV 77H,R2

  MOV 47H,R2

WAITT3:    ;~~~~~~~~~~~~~~~~~

  LCALL DISPLAY

  JNB P0.2,WAITT3

  JNB P0.3,WAITT3

  AJMP SETG5

SETG6:

  SETB 0CH   ;调星期时闪标志

GWAIT6:

  LCALL DISPLAY

  JNB P0.1,GWAIT6

SETG7:

  LCALL DISPLAY

  JNB P0.1,SETG8

  JNB P0.2,GADDWEEK

  JNB P0.3,JIANWEEK

  AJMP SETG7

GADDWEEK:

  MOV R7,64H       ;星期加一

  LCALL ADD1

  MOV 64H,A

  CJNE A,#07H,GADDWEEK1

  MOV 64H,#00H

  AJMP GADDWEEK1

JIANWEEK:

  MOV R7,64H       ;星期减一

  LCALL JIAN1

  MOV 64H,A

  CJNE A,#00H,GADDWEEK1

  MOV 64H,#06H

GADDWEEK1:

  MOV 32H,#8AH

  MOV 31H,64H     ;星期值送人1302

  LCALL WRITE

  MOV R0,64H

  LCALL DIVIDE  ;星期值划分送显示缓存

  MOV 48H,R1

  MOV 78H,R1

WAITT4:       ;~~~~~~~~~~~~~~~ ~~~~~

  LCALL DISPLAY

  JNB P0.2,WAITT4

  JNB P0.3,WAITT4

  AJMP SETG7

SETG8:

  SETB 0DH      ;调小不时闪标志

GWAIT8:

  LCALL DISPLAY

  JNB P0.1,GWAIT8

SETG9:

  LCALL DISPLAY

  JNB P0.1,SETG10

  JNB P0.2,GADDHOUR

  JNB P0.3,JIANHOUR

  AJMP SETG9

GADDHOUR:

  MOV R7,62H        ;小时加一

  LCALL ADD1

  MOV 62H,A

  CJNE A,#24H,GADDHOUR1

  MOV 62H,#00H

  AJMP GADDHOUR1

JIANHOUR:

  MOV R7,62H        ;小时减一

  LCALL JIAN1

  MOV 62H,A

  CJNE A,#00H,GADDHOUR1

  MOV 62H,#23H

GADDHOUR1:

  MOV 32H,#84H     ;小市价送人1302

  MOV 31H,62H

  LCALL WRITE

  MOV R0,62H

  LCALL DIVIDE      ;小市价划分送显示缓存

  MOV 74H,R1

  MOV 44H,R1

  MOV 75H,R2

  MOV 45H,R2

WAITT5:  ;~~~~~~~~~~~~~~~~~~~~~~~~~

  LCALL DISPLAY

  JNB P0.2,WAITT5

  JNB P0.3,WAITT5

  AJMP SETG9

SETG10:

  SETB 0EH        ;调分时间闪标志

GWAIT10:

  LCALL DISPLAY

  JNB P0.1,GWAIT10

SETG11:

  LCALL DISPLAY

  JNB P0.1,SETGOUT

  JNB P0.2,GADDMINTUE

  JNB P0.3,JIANMINTUE

  AJMP SETG11

GADDMINTUE:

  MOV R7,61H      ;分钟加一

  LCALL ADD1

  MOV 61H,A

  CJNE A,#60H,GADDMINTUE1

  MOV 61H,#00H

  AJMP GADDMINTUE1

JIANMINTUE:

  MOV R7,61H      ;分钟减一

  LCALL JIAN1

  MOV 61H,A

  CJNE A,#00H,GADDMINTUE1

  MOV 61H,#59H

GADDMINTUE1:

  MOV 32H,#82H    ;分钟值送人1302

  MOV 31H,61H

  LCALL WRITE

  MOV R0,61H

  LCALL DIVIDE    ;分钟值划分送显示缓存

  MOV 72H,R1

  MOV 42H,R1

  MOV 73H,R2

  MOV 43H,R2

WAITT6:

  LCALL DISPLAY

  JNB P0.2,WAITT6

  JNB P0.3,WAITT6

  AJMP SETG11

SETGOUT:

  LCALL DISPLAY

  JNB P0.1,SETGOUT

  LCALL GENGXIAN

  MOV 32H,#80H

  MOV 31H,#00H     ;1302晶振泉源振荡

  LCALL WRITE

  MOV 32H,#8EH

  MOV 31H,#80H     ;榨取写入1302

  LCALL WRITE

  CLR 08H

  CLR 09H

  CLR 0AH

  CLR 0BH

  CLR 0CH

  CLR 0DH

  CLR 0EH

  CLR 0FH

  CLR ET1                 ;关闪中止

  CLR TR1

  LJMP MAIN1

 

;;明灭调时法式模范模范~~~~~~~~~~~~~~~~

INTT1:

  PUSH ACC

  PUSH PSW

GFLASH:

  CPL 0FH

  JB 0FH,GFLASH1

  MOV 7CH,4CH ;一切显示

  MOV 7BH,4BH

  MOV 7AH,4AH

  MOV 79H,49H

  MOV 78H,48H

  MOV 77H,47H

  MOV 76H,46H

  MOV 75H,45H

  MOV 74H,44H

  MOV 73H,43H

  MOV 72H,42H

  MOV 71H,41H

  MOV 70H,40H

GFLASHOUT:

  POP PSW

  POP ACC

  RETI

GFLASH1:

  JB 0AH,GFLASH2 ;调年闪

  MOV 7CH,#0FH

  MOV 7BH,#0FH

  AJMP GFLASHOUT

GFLASH2:

  JB 0BH,GFLASH3 ;调月闪

  MOV 7AH,#0FH

  MOV 79H,#0FH

  AJMP GFLASHOUT

GFLASH3:

  JB 0CH,GFLASH4 ;调日闪

  MOV 77H,#0FH

  MOV 76H,#0FH

  AJMP GFLASHOUT

GFLASH4:

  JB 0DH,GFLASH5 ;调星期闪

  MOV 78H,#0FH

  AJMP GFLASHOUT

GFLASH5:

  JB 0EH,GFLASH6 ;调小时闪

  MOV 75H,#0FH

  MOV 74H,#0FH

  AJMP GFLASHOUT

GFLASH6:

  MOV 73H,#0FH ;调分钟闪

  MOV 72H,#0FH

  AJMP GFLASHOUT

 

;加一法式模范模范~~~~~~~~~~~~~~~~~~~~~~~~~

 

ADD1:

  MOV A,R7

  ADD A,#1

  DA A

  RET

;减一法式模范模范~~~~~~~~~~~~~~~~~~~~~~~~~

JIAN1:

  MOV A,R7

  DEC A

  CJNE A,#4FH,KK1

  MOV A,#49H

KK1:

  CJNE A,#3FH,KK2

  MOV A,#39H

KK2:

  CJNE A,#2FH,KK3

  MOV A,#29H

KK3:

  CJNE A,#1FH,KK4

  MOV A,#19H

KK4:

  CJNE A,#0FH,KK5

  MOV A,#09H

KK5:

  RET

 

;划分法式模范模范~~~~~~~~~~~~~~~~~~~~~~~~~

 

DIVIDE:

  MOV A,R0

  ANL A,#0FH

  MOV R1,A

  MOV A,R0

  SWAP A

  ANL A,#0FH

  MOV R2,A

  RET

 

;写1302法式模范模范~~~~~~~~~~~~~~~~~~~~~~~~~~

 

WRITE:

  CLR SCLK

  NOP

  SETB RST

  NOP

  MOV A,32H

  MOV R4,#8

WRITE1:

  RRC A    ;送地址给1302

  NOP

  NOP

  CLR SCLK

  NOP

  NOP

  NOP

  MOV IO,C

  NOP

  NOP

  NOP

  SETB SCLK

  NOP

  NOP

  DJNZ R4,WRITE1

  CLR SCLK

  NOP

  MOV A,31H

  MOV R4,#8

WRITE2:

  RRC A

  NOP    ;送数据给1302

  CLR SCLK

  NOP

  NOP

  MOV IO,C

  NOP

  NOP

  NOP

  SETB SCLK

  NOP

  NOP

  DJNZ R4,WRITE2

  CLR RST

  RET

 

;读1302法式模范模范~~~~~~~~~~~~~~~~~~~~~~~~~

 

READ:

  CLR SCLK

  NOP

  NOP

  SETB RST

  NOP

  MOV A,32H

  MOV R4,#8

READ1:

  RRC A   ;送地址给1302

  NOP

  MOV IO,C

  NOP

  NOP

  NOP

  SETB SCLK

  NOP

  NOP

  NOP

  CLR SCLK

  NOP

  NOP

  DJNZ R4,READ1

  MOV R4,#8

READ2:

  CLR SCLK

  NOP   ;从1302中读出数据

  NOP

  NOP

  MOV C,IO

  NOP

  NOP

  NOP

  NOP

  NOP

  RRC A

  NOP

  NOP

  NOP

  NOP

  SETB SCLK

  NOP

  DJNZ R4,READ2

  MOV 31H,A

  CLR RST

  RET

;BCD码转换为10进制法式模范模范~~~~~

 

BCD_10:

  MOV A,R0

  ANL A,#0FH

  MOV R1,A ;高位×10, 加低位

  MOV A,R0

  SWAP A

  ANL A,#0FH

  MOV B,#10

  MUL AB

  ADD A,R1

  MOV R0,A

  RET

 

;查一年数据法式模范模范~~~~~~~~~~~~~~~~

 

CHECKMONTH:

  LCALL BCD_10

 

;阴历和公历为统一年,

;NEW此时R2中的值为FFH时,R3有值,否则为0

NEW:

  NOP

M1:

  MOV A,R2  ;R2减一月天数

  CLR C

  SUBB A,#29

  MOV R1,A

  MOV A,R6

  JB ACC.6,SM11

  MOV A,R2

  CLR C

  SUBB A,#30

  MOV R1,A

SM11:

  JC SM12

  MOV A,R1      ;R2减1月天数,够减

  MOV R2,A      ;转二月

  AJMP M2

SM12:

  CJNE R3,#00H,M13 ;R2减1月天数

  LJMP Y1           ;不够减,判R3为0否

M13:

  MOV A,R2          ;不为0,R3加到R2中

  ADD A,R3          ;再让一月减

  MOV R2,A          ;还不够,则转Y1

  MOV R3,#00H

  AJMP M1

M2:

  CLR C        ;R2减一月天数,够减

  MOV A,R2   ;转三月

  SUBB A,#29

  MOV R1,A

  MOV A,R6

  JB ACC.5,M21

  MOV A,R2

  CLR C

  SUBB A,#30

  MOV R1,A

M21:

  JC M22

  MOV A,R1 ;R2减2月天数,够减

  MOV R2,A

  AJMP MM2

M22:

  CJNE R3,#00H,M23  ;R2减2月天数

  LJMP Y2         ;不够减,判,R3为0否

M23:

  MOV A,R2        ;不为0,R3加到R2中

  ADD A,R3        ;再让二月减

  MOV R2,A       ;还不够,则转Y2

  MOV R3,#00H

  AJMP M2

MM2:

  LCALL CHECKRE ;查2月,假定不为闰月

  CJNE A,#02H,M3  ;转3月

RM2:

  MOV A,R4

  ANL A,#0FH

  JNZ RM21

  MOV A,R2

  CLR C

  SUBB A,#30

  MOV R1,A

  AJMP RM22

RM21:

  MOV A,R2

  CLR C

  SUBB A,#29

  MOV R1,A

RM22:

  JC RM23

  MOV A,R1 ;R2减闰2月天数,够减

  MOV R2,A  ;转3月

  AJMP M3

RM23:

  CJNE R3,#00H,RM24 ;R2减闰2月天数

  LJMP RY2     ;不够减,判,R3为0否

RM24:

  MOV A,R2        ;不为0,R3加到R2中

  ADD A,R3        ;再让闰2月减

  MOV R3,#00H     ;还不够,则转RY2

 

  SUBB A,#30

  MOV R1,A

M121:

  CJNE R3,#00H,M122  ;R2减12月天数

  LJMP Y12           ;不够减,判,R3为0否

M122:

  MOV A,R2           ;不为0,R3加到R2中

  ADD A,R3           ;再让12月减

  MOV R2,A           ;还不够,则转Y12

  MOV R3,#00H

  LJMP M12

Y1:

  MOV A,R2

  MOV R0,A      ;R2中为日的值

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#01H

  CLR F0   ;非闰月

  LJMP S_PLAY

Y2:

  CJNE R2,#00H,Y21

  MOV A,R6     ;R2中为0,则为前一个月

  MOV 56H,#29H ;的的最后一天

  JB ACC.6,Y22

  MOV 56H,#30H

Y22:

  MOV 57H,#01H

  CLR F0

  LJMP S_PLAY

Y21:

  MOV A,R2

  MOV R0,A    ;R2中为日的值

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#02H

  CLR F0

  LJMP S_PLAY

RY2:

  CJNE R2,#00H,RY21

  MOV 56H,#29H ;R2中为0,则为前一个月

  MOV A,R6     ;的的最后一天

  JB ACC.5,RY22

  MOV 56H,#30H

RY22:

  MOV 57H,#02H

  CLR F0

  LJMP S_PLAY

RY21:

  MOV A,R2    ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#02H

  SETB F0   ;闰月

  LJMP S_PLAY

Y3:

  CJNE R2,#00H,Y31

  LCALL CHECKRE     ;查前一个月能否为闰月

  CJNE A,#02H,Y32

  MOV 56H,#29H      ;前一个月是闰月

  MOV A,R4

  ANL A,#0FH  ;R2中为0,则为前一个月

  JNZ Y33            ;的的最后一天

  MOV 56H,#30H

  MOV 57H,#02H

  SETB F0

  LJMP S_PLAY

Y33:

  MOV 57H,#02H

  SETB F0

  LJMP S_PLAY

Y32:

  MOV 56H,#29H ;前一个月不是闰月

  MOV A,R6

  JB ACC.5,Y34

  MOV 56H,#30H

Y34:

  MOV 57H,#02H

  CLR F0

  LJMP S_PLAY

Y31:

  MOV A,R2

  MOV R0,A     ;R2中为日的值

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#03H

  CLR F0

  LJMP S_PLAY

RY3:

  CJNE R2,#00H,RY31

  MOV 56H,#29H

  MOV A,R6

  JB ACC.4,RY32   ;R2中为0,则为前一个月

  MOV 56H,#30H    ;的的最后一天

RY32:

  MOV 57H,#03H

  CLR F0

  LJMP S_PLAY

RY31:

  MOV A,R2      ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#03H

  SETB F0

  LJMP S_PLAY

Y4:

  CJNE R2,#00H,Y41

  LCALL CHECKRE    ;查前一个月能否为闰月

  CJNE A,#03H,Y42

  MOV 56H,#29H     ;前一个月是闰月

  MOV A,R4         ;R2中为0,则为前一个月

  ANL A,#0FH       ;的最后一天

  JNZ Y43

  MOV 56H,#30H

  MOV 57H,#03H

  SETB F0

  LJMP S_PLAY

Y43:

  MOV 57H,#03H

  SETB F0

  LJMP S_PLAY

Y42:

  MOV 56H,#29H ;前一个月不是闰月

  MOV A,R6

  JB ACC.4,Y44

  MOV 56H,#30H

Y44:

  MOV 57H,#03H

  CLR F0

  LJMP S_PLAY

Y41:

  MOV A,R2      ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#04H

  CLR F0

  LJMP S_PLAY

RY4:

  CJNE R2,#00H,RY41

  MOV 56H,#29H    ;R2中为0,则为前一个月

  MOV A,R6        ;的的最后一天

  JB ACC.2,RY42

  MOV 56H,#30H

RY42:

  MOV 57H,#04H

  CLR F0

  LJMP S_PLAY

RY41:

  MOV A,R2      ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#04H

  SETB F0

  LJMP S_PLAY

Y5:

  CJNE R2,#00H,Y51

  LCALL CHECKRE ;查前一个月能否为闰月

  CJNE A,#04H,Y52

  MOV 56H,#29H ;前一个月是闰月

  MOV A,R4    ;R2中为0,则为前一个月

  ANL A,#0FH         ;的最后一天

  JNZ Y53

  MOV 56H,#30H

  MOV 57H,#04H

  SETB F0

  LJMP S_PLAY

Y53:

  MOV 57H,#04H

  SETB F0

  LJMP S_PLAY

Y52:

  MOV 56H,#29H  ;前一个月不是闰月

  MOV A,R6

  JB ACC.2,Y54

  MOV 56H,#30H

Y54:

  MOV 57H,#04H

  CLR F0

  LJMP S_PLAY

Y51:

  MOV A,R2      ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#05H

  CLR F0

  LJMP S_PLAY

RY5:

  CJNE R2,#00H,RY51

  MOV 56H,#29H    ;R2中为0,则为前一个月

  MOV A,R6        ;的最后一天

  JB ACC.1,RY52

  MOV 56H,#30H

RY52:

  MOV 57H,#05H

  CLR F0

  LJMP S_PLAY

RY51:

  MOV A,R2    ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#05H

  SETB F0

  LJMP S_PLAY

Y6:

  CJNE R2,#00H,Y61

  LCALL CHECKRE   ;查前一个月能否为闰月

  CJNE A,#05H,Y62

  MOV 56H,#29H    ;前一个月是闰月

  MOV A,R4    ;R2中为0,则为前一个月

  ANL A,#0FH      ;的最后一天

  JNZ Y63

  MOV 56H,#30H

  MOV 57H,#05H

  SETB F0

  LJMP S_PLAY

Y63:

  MOV 57H,#05H

  SETB F0

  LJMP S_PLAY

Y62:

  MOV 56H,#29H  ;前一个月不是闰月

  MOV A,R6

  JB ACC.1,Y64

  MOV 56H,#30H

Y64:

  MOV 57H,#05H

  CLR F0

  LJMP S_PLAY

Y61:

  MOV A,R2        ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#06H

  CLR F0

  LJMP S_PLAY

RY6:

  CJNE R2,#00H,RY61

  MOV 56H,#29H ;R2中为0,则为前一个月

  MOV A,R6    ;的最后一天

  JB ACC.0,RY62

  MOV 56H,#30H

RY62:

  MOV 57H,#06H

  CLR F0

  LJMP S_PLAY

RY61:

  MOV A,R2    ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#06H

  SETB F0

  LJMP S_PLAY

Y7:

  CJNE R2,#00H,Y71

  LCALL CHECKRE    ;查前一个月能否为闰月

  CJNE A,#06H,Y72

  MOV 56H,#29H     ;前一个月是闰月

  MOV A,R4         ;R2中为0,则为前一个月

  ANL A,#0FH       ;的最后一天

  JNZ Y73

  MOV 56H,#30H

  MOV 57H,#06H

  SETB F0

  LJMP S_pLAY

Y73:

  MOV 57H,#06H

  SETB F0

  LJMP S_PLAY

Y72:

  MOV 56H,#29H  ;前一个月不是闰月

  MOV A,R6

  JB ACC.0,Y74

  MOV 56H,#30H

Y74:

  MOV 57H,#06H

  CLR F0

  LJMP S_PLAY

Y71:

  MOV A,R2        ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#07H

  CLR F0

  LJMP S_PLAY

RY7:

  CJNE R2,#00H,RY71

  MOV 56H,#29H    ;R2中为0,则为前一个月

  MOV A,R5        ;的最后一天

  JB ACC.6,RY72

  MOV 56H,#30H

RY72:

  MOV 57H,#07H

  CLR F0

  LJMP S_PLAY

RY71:

  MOV A,R2     ;R2中为日的值

  MOV R0,A

  LCALL D_BCD

  MOV 56H,A

  MOV 57H,#07H

  SETB F0

  LJMP S_PLAY

Y8:

  CJNE R2,#00H,Y81

  LCALL CHECKRE ;查前一个月能否为闰月

  CJNE A,#07H,Y82

  MOV 56H,#29H     ;前一个月是闰月

  MOV A,R4    ;R2中为0,则为前一个月

  ANL A,#0FH       ;的最后一天

  JNZ Y83

  MOV 56H,#30H

  MOV 57H,#07H

  SETB F0

  LJMP S_PLAY

Y83:

  MOV 57H,#07H

  SETB F0

  LJMP S_PLAY

Y82:

  MOV 56H,#29H ;前一个月不是闰月

  MOV A,R5

  JB ACC.6,Y84

  MOV 56H,#30H

Y84:

  MOV 57H,#07H

  CLR F0

  LJMP S_PLAY

Y81:

  MOV A,R2    ;R2中为日的值

 

 

DL1MS:

  MOV R6,#14H

DL1:

  MOV R7,#19H

DL2:

  DJNZ R7,DL2

  DJNZ R6,DL1

  RET

 

;数据表~~~~~~~~~~~~~~~~~~~`~~

TAB:

  DB35,15H,51H,00H,23,11H,52H,41H,42,12H,65H,00H

  DB31,11H,32H,00H,21,42H,52H,21H,39,52H,25H,00H

  DB28,25H,04H,71H,48,66H,42H,00H,37,33H,22H,00H

  DB25,15H,24H,51H,44,05H,52H,00H,33,22H,65H,00H

  DB22,21H,25H,41H,40,24H,52H,00H,30,52H,42H,91H

  DB49,55H,05H,00H,38,26H,44H,00H,27,53H,50H,60H

  DB 46,53H,24H,00H,35,25H,54H,00H,24,41H,52H,41H

  DB42,45H,25H,00H,31,24H,52H,00H,21,51H,12H,21H

  DB40,55H,11H,00H,28,26H,21H,61H,47,26H,61H,00H

  DB36,13H,31H,00H,25,05H,31H,51H,43,12H,54H,00H

  DB33,51H,25H,00H,22,42H,25H,31H,41,32H,22H,00H

  DB 30,55H,02H,71H,49,55H,22H,00H,38,26H,62H,00H

  DB27,13H,64H,60H,45,13H,32H,00H,34,12H,55H,00H

  DB23,10H,53H,51H,42,22H,45H,00H,31,52H,22H,00H

  DB21,52H,44H,21H,40,55H,44H,00H,29,26H,50H,71H

  DB47,26H,64H,00H,36,25H,32H,00H,25,23H,32H,50H

  DB 44,44H,55H,00H,32,24H,45H,00H,22,55H,11H,30H
  END