好文档 - 专业文书写作范文服务资料分享网站

51单片机电子万年历设计电路图及程序

天下 分享 时间: 加入收藏 我要投稿 点赞

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

CJNE R2,#00H,Y51

LCALL CHECKRE ;查前一个月是否为闰月 CJNE A,#04H,Y52

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

Y5:

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

51单片机电子万年历设计电路图及程序

JNZRM21MOVA,R2CLRCSUBBA,#30MOVR1,AAJMPRM22RM21:MOVA,R2CLRCSUBBA,#29MOVR1,ARM22:JCRM23MOVA,R1;R2减闰2月天数,够减MOV
推荐度:
点击下载文档文档为doc格式
6u50n4otyv3z01x0bcix
领取福利

微信扫码领取福利

微信扫码分享