求51单片机C51LED灯渐亮渐暗程序。。

求51单片机C51LED灯渐亮渐暗程序。。,第1张

// LedTimeCount应该为100

// 把下面这段的宏定义放在前面,代码段覆盖你原来那段试试

// 注意保存和备份

// LED = 0表示灯亮,LED = 1表示灯灭,如果是反着的就把下面的0和1换一下,或者改下宏定义

// pwmcount初始值为三角波,因此后半段的意思是把100次分为pwmcount自减段和常0段

// 如果自减段和常0段LED都为0则常亮

// c为偶数时pwmcount逐渐增加,自减段增加,此时LED如果为0,常0段为1,则变亮,反之变暗

// c为奇数时pwmcount逐渐减小,自减段减小,此时LED如果为1,常0段为0,则变亮,反之变暗

#define fLED(a,b,c) {LED1 = aLED2 = bLED3 = c}

if (pwmcount >0)

{

switch(c)

{

case 0://1变亮,2常亮,3变暗

fLED(0,0,1)

break

case 1://1常亮,2变暗,3变亮

fLED(0,0,1)

break

case 2://1变暗,2变亮,3常亮

fLED(1,0,0)

break

case 3://1变亮,2常亮,3变暗

fLED(1,0,0)

break

case 4://1常亮,2变暗,3变亮

fLED(0,1,0)

break

case 5://1变暗,2变亮,3常亮

fLED(0,1,0)

break

}

pwmcount--

}

else

{

switch(c)

{

case 0://1变亮,2常亮,3变暗

fLED(1,0,0)

break

case 1://1常亮,2变暗,3变亮

fLED(0,1,0)

break

case 2://1变暗,2变亮,3常亮

fLED(0,1,0)

break

case 3://1变亮,2常亮,3变暗

fLED(0,0,1)

break

case 4://1常亮,2变暗,3变亮

fLED(0,0,1)

break

case 5://1变暗,2变亮,3常亮

fLED(1,0,0)

break

}

}

ORG 0000H

LJMP MAIN

ORG 000BH

LJMP ZD

MAIN:MOV SP,#70H

MOV TMOD,#02H 设定时器初始化为方式二

SETB EA 开中断总允许

SETB ET0允许T0中断

SETB TR0启动定时器

MOV TH0,#06H 初始化定时器为0.5ms

MOV TL0,#06H

MOV 38H,#00H 置软件计数器计数初值

MOV 39H,#00H

MOV R4,#3定时器调整时用来循环选择需三次

MOV R3,#2调整拆字需两次

MOV 3AH,#0 秒单元初值

MOV 3BH,#0分单元初值

MOV 3CH,#0 时单元初值

MOV 60H,#0H 闪烁控制初值,置零为不闪烁

MOV 62H,#1H响铃方式选择初值,置1为方式1

MOV 63H,#0H 调整定时和时间显示切换

MOV 64H,#1H 打铃时间设置,置1为第一组,本程序为8组

定时时间调整时用来选择哪个单元用的初值

MOV 53H,#3FH第一组

MOV 54H,#41H第二组

MOV 55H,#43H

MOV 56H,#45H

MOV 57H,#47H

MOV 58H,#49H

MOV 59H,#4BH

MOV 5AH,#4DH 第八组

MOV R5,#8 对65H~6CH单元置1,这些单元是用来存放每组下的打铃方式

MOV R1,#64H

FH1:INC R1

MOV @R1,#1H

DJNZ R5,FH1

MOV R5,#16

MOV R1,#3FH

FH:INC R1对40H~4FH单元清零,这些单元是用来存放每组状态下所要设置的时间

MOV @R1,#0

DJNZ R5,FH

MOV 52H,#39H 时间显示时对个单元调整标志

MOV 50H,#0H闪烁时亮暗所用的时间

MOV 51H,#0H

MOV DPTR,#0FEFFH初始化8255 A,B口为输出 c口为输入

MOV A,#89H

MOVX @DPTR,A 初始化到此

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

以下为主程序

KEY:LCALL KS1 键盘扫描

JNZ ZC0 判1转移,若为1,则表示有键按下,跳到再次确认

LJMP Q1

ZC0:LJMP ZC

Q1:MOV A,63H

CJNE A,#1H,HQ3

LCALL TZCZ

LJMP H5

HQ3:LCALL CZ

H5:MOV A,60H 若(60H)=10H,进入暗程序

CJNE A,#10H,SS11

LCALL SS1

SS11:MOV A,60H

CJNE A,#11H,SS22若(60)=11H,进入亮程序 ;若不在置(60H)=0,则就是在这里来回亮暗,即闪烁效果

LCALL SS2

SS22:MOV A,61H若满足定时设置的时间,61H会置相应是哪组满足定时条件

CJNE A,#1H,D22以下为去对应组存放的响铃方式,共8组

MOV 62H,65H

MOV 61H,#0

LCALL FSCX 掉用响铃方式

D22: MOV A,61H

CJNE A,#2H,D33

MOV 61H,#0

MOV 62H,66H

LCALL FSCX

D33:MOV A,61H

CJNE A,#3H,D44

MOV 62H,67H

MOV 61H,#0

LCALL FSCX

D44:MOV A,61H

CJNE A,#4H,D55

MOV 62H,68H

MOV 61H,#0

LCALL FSCX

D55:MOV A,61H

CJNE A,#5H,D66

MOV 61H,#0

MOV 62H,69H

LCALL FSCX

D66:MOV A,61H

CJNE A,#6H,D77

MOV 62H,6AH

MOV 61H,#0

LCALL FSCX

D77:MOV A,61H

CJNE A,#7H,D88

MOV 62H,6BH

MOV 61H,#0

LCALL FSCX

D88:MOV A,61H

CJNE A,#8H,HQ2

MOV 62H,6CH

MOV 61H,#0

LCALL FSCX

LJMP KEY

HQ2:LCALL XS

LJMP KEY

FSCX:

MOV A,62H 响铃方式控制,若为1,进入方式1,若为2,进入方式2,若为3,进入方式3

CJNE A,#1H,N2

CLR P3.5

MOV P1,#11111110B

N2:MOV A,62H

CJNE A,#2H,N3

CLR P3.5

MOV P1,#11111101B

N3:MOV A,62H

CJNE A,#3H,TCFSCX

CLR P3.5

MOV P1,#11111011B

TCFSCX:RET

ZC:LCALL D5MS 再次确认是否有键按下

LCALL D5MS

LCALL D5MS

LCALL KS1

MOV B,A

JNZ DR 等待键释放

LJMP KEY

DR:LCALL XS

LCALL KS1

JNZ DR

MOV A,B 查询是哪个键按下

JB ACC.0,K0

JB ACC.1,K11

JB ACC.2,K22

JB ACC.3,K33

JB ACC.4,K44

JB ACC.5,K55

LJMP KEY

K22:LJMP K2

K11:LJMP K1

K33:LJMP K3

K44:LJMP K4

K55:LJMP K5

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

K1子程序

K0:MOV 60H,#10H

MOV A,63H

CJNE A,#0H,DSTZ 若为0,则对时间显示调整选取要 *** 作的位位闪烁

CLR TR0

INC 52H

MOV A,52H

CJNE A,#3DH,TCK00

LJMP XM

TCK00:LJMP TCK0

XM:MOV 52H,#39H

MOV 60H,#0

SETB TR0

LJMP KEY

DSTZ:MOV A,64H以下为定时调整控制

CJNE A,#01H,H2 若为1,对第一组调整选取要 *** 作的位闪烁

INC 53H

DJNZ R4,TCK0

MOV 60H,#0

MOV 53H,#3FH

MOV R4,#3

H2:MOV A,64H

CJNE A,#02H,H3 若为2,对第二组调整选取要 *** 作的位闪烁

INC 54H

DJNZ R4,TCK0

MOV 60H,#0

MOV 54H,#41H

MOV R4,#3

H3:MOV A,64H

CJNE A,#03H,H4 若为2,对第三组调整选取要 *** 作的位闪烁

INC 55H

DJNZ R4,TCK0

MOV 60H,#0

MOV 55H,#43H

MOV R4,#3

H4:MOV A,64H

CJNE A,#04H,H55

INC 56H

DJNZ R4,TCK0

MOV 60H,#0

MOV 56H,#45H

MOV R4,#3

H55:MOV A,64H

CJNE A,#05H,H6

INC 57H

DJNZ R4,TCK0

MOV 60H,#0

MOV 57H,#47H

MOV R4,#3

H6:MOV A,64H

CJNE A,#06H,H7

INC 58H

DJNZ R4,TCK0

MOV 60H,#0

MOV 58H,#49H

MOV R4,#3

H7:MOV A,64H

CJNE A,#07H,H8

INC 59H

DJNZ R4,TCK0

MOV 60H,#0

MOV 59H,#4BH

MOV R4,#3

H8:MOV A,64H

CJNE A,#08H,TCK0 对第八组调整

INC 5AH

DJNZ R4,TCK0

MOV R4,#3

MOV 5AH,#4DH

MOV 60H,#0

TCK0:

LJMP KEY

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

K1:MOV A,63H k1子程序

CJNE A,#0H,DSTZK1 若为0,则对时间显示调整,若为1,则转到定时调整调整相应组的定时时间

MOV R0,52H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,52H

CJNE A,#3AH,MIN

MOV A,3AH

CJNE A,#60H,TCK101

MOV 3AH ,#0

MIN: MOV A,52H

CJNE A,#3BH,HOU

MOV A,3BH

CJNE A,#60H,TCK101

MOV 3BH,#0

HOU:MOV A,52H

CJNE A,#3CH,TCK101

MOV A,3CH

CJNE A,#24H,TCK101

MOV 3CH,#0

LJMP KEY

DSTZK1:MOV A,64H

CJNE A,#1H,Q31

MOV R0,53H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,53H

CJNE A,#40H,BJS1

MOV A,40H

CJNE A,#60H,TCK101

MOV 40H,#0

BJS1:MOV A,53H

CJNE A,#41H,TCK101

LJMP F8

TCK101:LJMP TCK1

F8:MOV A,41H

CJNE A,#24H,TCK10

MOV 41H,#0

LJMP TCK1

Q31:MOV A,64H

CJNE A,#2H,Q32

MOV R0,54H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,54H

CJNE A,#42H,BJS2

MOV A,42H

CJNE A,#60H,TCK10

MOV 42H,#0

BJS2:MOV A,54H

CJNE A,#43H,TCK10

MOV A,43H

CJNE A,#24H,TCK10

MOV 43H,#0

LJMP TCK1

Q32:MOV A,64H

CJNE A,#3H,Q33

MOV R0,55H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,55H

CJNE A,#44H,BJS3

MOV A,44H

CJNE A,#60H,TCK10

MOV 44H,#0

BJS3:MOV A,55H

CJNE A,#45H,TCK10

MOV A,45H

CJNE A,#24H,TCK10

MOV 45H,#0

LJMP TCK1

Q33:MOV A,64H

CJNE A,#4H,Q34

MOV R0,56H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,56H

CJNE A,#46H,BJS4

MOV A,46H

CJNE A,#60H,TCK10

MOV 46H,#0

BJS4:MOV A,56H

CJNE A,#47H,TCK10

MOV A,47H

CJNE A,#24H,TCK10

MOV 47H,#0

TCK10:LJMP TCK1

Q34:MOV A,64H

CJNE A,#5H,Q35

MOV R0,57H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,57H

CJNE A,#48H,BJS5

MOV A,48H

CJNE A,#60H,TCK1A

MOV 48H,#0

BJS5:MOV A,57H

CJNE A,#49H,TCK1A

MOV A,49H

CJNE A,#24H,TCK1A

MOV 49H,#0

TCK1A:LJMP TCK1

Q35:MOV A,64H

CJNE A,#6H,Q36

MOV R0,58H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,58H

CJNE A,#4AH,BJS6

MOV A,4AH

CJNE A,#60H,TCK1

MOV 4AH,#0

BJS6:MOV A,58H

CJNE A,#4BH,TCK1

MOV A,4BH

CJNE A,#24H,TCK1

MOV 4BH,#0

LJMP TCK1

Q36:MOV A,64H

CJNE A,#7H,Q37

MOV R0,59H

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,59H

CJNE A,#4CH,BJS7

MOV A,4CH

CJNE A,#60H,TCK1

MOV 4CH,#0

BJS7:MOV A,59H

CJNE A,#4DH,TCK1

MOV A,4DH

CJNE A,#24H,TCK1

MOV 4DH,#0

LJMP TCK1

Q37:

MOV A,64H

CJNE A,#8H,TCK1

MOV R0,5AH

MOV A,@R0

ADD A,#1

DA A

MOV @R0,A

MOV A,5AH

CJNE A,#4EH,BJS8

MOV A,4EH

CJNE A,#60H,TCK1

MOV 4EH,#0

BJS8:MOV A,5AH

CJNE A,#4FH,TCK1

MOV A,4FH

CJNE A,#24H,TCK1

MOV 4FH,#0

LJMP TCK1

TCK1:LJMP KEY

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

K2:CPL 21H

JB 21H,ZDTZ

MOV 63H,#0H

LJMP KEY

ZDTZ:MOV 63H,#1H

LJMP KEY

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

K3:

INC 64H

MOV A,64H

CJNE A,#9H,TCK3

MOV 64H,#1H

TCK3:LJMP KEY

K4:MOV A,64H

CJNE A,#1H,Y2

INC 65H

MOV A,65H

CJNE A,#4H,TCK4

MOV 65H,#1H

Y2:MOV A,64H

CJNE A,#2H,Y3

INC 66H

MOV A,65H

CJNE A,#4H,TCK4

MOV 66H,#1H

Y3:MOV A,64H

CJNE A,#3H,Y4

INC 67H

MOV A,67H

CJNE A,#4H,TCK4

MOV 67H,#1H

Y4:MOV A,64H

CJNE A,#4H,Y5

INC 68H

MOV A,68H

CJNE A,#4H,TCK4

MOV 68H,#1H

Y5:MOV A,64H

CJNE A,#5H,Y6

INC 69H

MOV A,69H

CJNE A,#4H,TCK4

MOV 69H,#1H

Y6:MOV A,64H

CJNE A,#6H,Y7

INC 6AH

MOV A,6AH

CJNE A,#4H,TCK4

MOV 6AH,#1H

Y7:MOV A,64H

CJNE A,#7H,Y8

INC 6BH

MOV A,6BH

CJNE A,#4H,TCK4

MOV 6BH,#1H

Y8:MOV A,64H

CJNE A,#8H,TCK4

INC 6CH

MOV A,6CH

CJNE A,#4H,TCK4

MOV 6CH,#1H

TCK4:LJMP KEY

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

K5:SETB P3.5

LJMP KEY

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

KS1:MOV DPTR,#0FEFEH

MOVX A,@DPTR

CPL A

ANL A,#03H

RET

SS1:MOV A,63H

CJNE A,#0H,Q3

MOV A,52H

CJNE A,#3AH,HQ1

MOV 30H,#0BH

MOV 31H,#0BH

HQ1:CJNE A,#3BH,Q2

MOV 33H,#0BH

MOV 34H,#0BH

Q2:CJNE A,#3CH,Q3

MOV 36H,#0BH

MOV 37H,#0BH

LJMP Q22

Q3:MOV A,64H

CJNE A,#1H,Q5

MOV A,53H

CJNE A,#40H,Q4

MOV 30H,#0BH

MOV 31H,#0BH

Q4:CJNE A,#41H,Q5

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q5:MOV A,64H

CJNE A,#2H,Q7

MOV A,54H

CJNE A,#42H,Q6

MOV 30H,#0BH

MOV 31H,#0BH

Q6:CJNE A,#43H,Q7

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q7:MOV A,64H

CJNE A,#3H,Q9

MOV A,55H

CJNE A,#44H,Q8

MOV 30H,#0BH

MOV 31H,#0BH

Q8:CJNE A,#45H,Q9

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q9:MOV A,64H

CJNE A,#4H,Q11

MOV A,56H

CJNE A,#46H,Q10

MOV 30H,#0BH

MOV 31H,#0BH

Q10:CJNE A,#47H,Q11

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q11: MOV A,64H

CJNE A,#5H,Q13

MOV A,57H

CJNE A,#48H,Q12

MOV 30H,#0BH

MOV 31H,#0BH

Q12:CJNE A,#49H,Q13

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q13:MOV A,64H

CJNE A,#6H,Q15

MOV A,58H

CJNE A,#4AH,Q14

MOV 30H,#0BH

MOV 31H,#0BH

Q14:CJNE A,#4BH,Q15

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q15:MOV A,64H

CJNE A,#7H,Q17

MOV A,59H

CJNE A,#4CH,Q16

MOV 30H,#0BH

MOV 31H,#0BH

Q16:CJNE A,#4DH,Q17

MOV 33H,#0BH

MOV 34H,#0BH

LJMP Q22

Q17:MOV A,64H

CJNE A,#8H,Q22

MOV A,5AH

CJNE A,#4EH,Q18

MOV 30H,#0BH

MOV 31H,#0BH

Q18:CJNE A,#4FH,Q22

MOV 33H,#0BH

MOV 34H,#0BH

Q22:INC 50H

MOV A,50H

CJNE A,#20H,Q221

MOV 60H,#11H

MOV 50H,#0

Q221:RET

SS2:INC 51H

LCALL CZ

MOV A,63H

CJNE A,#0,DSTZ0

LJMP SW

DSTZ0:LCALL TZCZ

SW:MOV A,51H

CJNE A,#20H,NEXT22

MOV 60H,#10H

MOV 51H,#0

NEXT22:RET

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

中断程序

ZD:PUSH ACC

PUSH PSW

INC 38H

MOV A,38H

CJNE A,#200,TC0

LJMP F1

TC0:LJMP TC

F1:MOV 38H,#0

INC 39H

MOV A,39H

CJNE A,#10,TC1

LJMP F2

TC1:LJMP TC

F2:MOV 39H,#0

MOV A,3AH

ADD A,#1

DA A

MOV 3AH,A

CJNE A,#60H,TC3

LJMP F3

TC3:LJMP TC

F3:MOV 3AH,#0

MOV A,3BH

ADD A ,#1

DA A

MOV 3BH,A

SETB P3.5

MOV A,3BH

CJNE A,40H,D2

MOV A,3CH

CJNE A,41H,D2

MOV 61H,#01H

LJMP HQ

D2:MOV A,3BH

CJNE A,42H,D3

MOV A,3CH

CJNE A,43H,D3

MOV 61H,#02H

LJMP HQ

D3:MOV A,3BH

CJNE A,44H,D4

MOV A,3CH

CJNE A,45H,D4

MOV 61H,#03H

LJMP HQ

D4:MOV A,3BH

CJNE A,46H,D5

MOV A,3CH

CJNE A,47H,D5

MOV 61H,#04H

LJMP HQ

D5:MOV A,3BH

CJNE A,48H,D6

MOV A,3CH

CJNE A,49H,D6

MOV 61H,#05H

LJMP HQ

D6:MOV A,3BH

CJNE A,4AH,D7

MOV A,3CH

CJNE A,4BH,D7

MOV 61H,#06H

LJMP HQ

D7:MOV A,3BH

CJNE A,4CH,D8

MOV A,3CH

CJNE A,4DH,D8

MOV 61H,#07H

LJMP HQ

D8:MOV A,3BH

CJNE A,4EH,HQ

MOV A,3CH

CJNE A,4FH,HQ

MOV 61H,#08H

HQ:MOV A,3BH

CJNE A,#60H,TC

MOV 3BH,#0

MOV A,3CH

ADD A ,#1

DA A

MOV 3CH,A

CJNE A,#24H,TC

MOV 3CH,#0

TC: POP PSW

POP ACC

RETI

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

显示程序

XS:MOV R1,#30H

MOV R3,#01H

MOV A,R3

SC:MOV DPTR,#0FEFDH

MOVX @DPTR,A

MOV DPTR,#0FEFCH

MOV A,@R1

ADD A,#TAB-NPC

MOVC A,@A+PC

NPC:MOVX @DPTR,A

LCALL D1MS

INC R1

MOV A,R3

JB ACC.7,DISP2

RL A

MOV R3,A

SJMP SC

MOV R3,#01H

DISP2:RET

D1MS:MOV R7,#250

DJNZ R7,$

RET

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

时间拆字程序

CZ:MOV R0,#3AH

MOV R1,#30H

ZQ: MOV A,@R0

ANL A,#0FH

MOV @R1,A

INC R1

MOV A,@R0

ANL A,#0F0H

SWAP A

MOV @R1,A

INC R0

INC R1

INC R1

CJNE R0,#3DH,ZQ

MOV 32H,#0AH

MOV 35H,#0AH

RET

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

时间调整拆字程序

TZCZ:MOV A,64H

CJNE A,#01H,E2

MOV 62H,65H

MOV R0,#40H

MOV 36H,#01H

E2:MOV A,64H

CJNE A,#02H,E3

MOV 62H,66H

MOV R0,#42H

MOV 36H,#02H

E3:MOV A,64H

CJNE A,#03H,E4

MOV 62H,67H

MOV R0,#44H

MOV 36H,#03H

E4:MOV A,64H

CJNE A,#04H,E5

MOV 62H,68H

MOV R0,#46H

MOV 36H,#04H

E5:MOV A,64H

CJNE A,#05H,E6

MOV 62H,69H

MOV R0,#48H

MOV 36H,#05H

E6:MOV A,64H

CJNE A,#06H,E7

MOV 62H,6AH

MOV R0,#4AH

MOV 36H,#06H

E7:MOV A,64H

CJNE A,#07H,E8

MOV 62H,6BH

MOV R0,#4CH

MOV 36H,#07H

E8:

MOV A,64H

CJNE A,#08H,E1

MOV 62H,6CH

MOV R0,#4EH

MOV 36H,#08H

E1:MOV R1,#30H

MOV R3,#2

CHOU:MOV A,@R0

ANL A,#0FH

MOV @R1,A

MOV A,@R0

ANL A,#0F0H

SWAP A

INC R1

MOV @R1,A

INC R0

INC R1

INC R1

DJNZ R3,CHOU

MOV R3,#2

MOV A,62H

CJNE A,#1H,FS2

MOV 37H,#0CH

FS2:MOV A,62H

CJNE A,#2H,FS3

MOV 37H,#0DH

FS3:MOV A,62H

CJNE A,#3H,H1

MOV 37H,#0EH

H1:MOV 32H,#0AH

MOV 35H,#11H

RET

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

TAB:DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0BFH,0FFH,88H,83H,0C6H,86H,0B0H,0B6H

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

D5MS: MOV R6,#5

SM: MOV R7,#250

ZS:DJNZ R7,ZS

DJNZ R6,SM

RET

END


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7724904.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-09
下一篇 2023-04-09

发表评论

登录后才能评论

评论列表(0条)

保存