微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > 本人初学者,希望大神们帮我把这个代码标上注释,谢谢..

本人初学者,希望大神们帮我把这个代码标上注释,谢谢..

时间:10-02 整理:3721RD 点击:

ORG  0000H

AJMP  MAIN

ORG  0013H

LJMP  IN1

ORG  0030H

MAIN:MOV  SP,#60H

MOV  P1,#0FH

SETB  P1.4

SETB  EA

SETB  EX1

MOV  5AH,#0

MOV  5BH,#2

MOV  5CH,#5

MOV  5DH,#0

MOV  28H,#0

MOV  TCON,#05H

MOV  29H,#01H

MOV  35H,#10

MOV  37H,#10

LOOP:MOV  A,35H

CJNE  A,#1,NEXT

LJMP  N1

NEXT:LCALL  AD

MOV  R2,#0

MOV  R3,40H

LCALL  Q1

MOV  3AH,R2

MOV  3BH,R3

LCALL  BJ

LCALL  DIR

LCALL  TIM

LJMP  LOOP

NI:LCALL  SD

N4:MOV  A,35H

CJNE  A,#2,N2

MOV  A,R4

ADD  A,#1

MOV  52H,A

CLR  C

MOV  A,R4

SUBB  A,#1

MOV  53H,A

MOV  A,31H

MOV  5AH,A

MOV  A,32H

MOV  5BH,A

MOV  A,33H

MOV  5CH,A

MOV  A,34H

MOV  5DH,A

RET

IN1:PUSH  PSW

PUSH  ACC

CLR  EX1

MOV  A,P1

RRC  A

JC  M1

MOV  35H,#1

LJMP  TT

M1:RRC  A

JC  M2

MOV  35H,#2

MOV  A,28H

SETB  ACC.0

MOV  28H,A

LJMP  TT

M2:RRC  A

JC  M3

MOV  35H,#3

MOV  A,28H

SETB  ACC.0

MOV  28H,A

LJMP  TT

M3:RRC  A

JC  TT

MOV  35H,#4

TT:NOP

POP  ACC

POP  PSW

SETB  EX1

RETI

AD1:MOV  A,37H

ANL  A,#0FH

ORL  A,#30H

MOV  R1, A

MOV  A,@R1

INC  A

MOV  B,#10

div  AB

MOV  A,B

MOV  @R1,A

RET

IDB:MOV  30H,#0

MOV  R0,#30H

MOV  R2,#3

MOV  R3,#0

MOV  A,@R0

MOV  R4,A

LP:MOV  A,R4

MOV  B,#10

MUL  AB

MOV  R4,A

MOV  A,#10

XCH  A,B

XCH  A,R3

MUL  AB

ADD  A,R3

XCH  A,R4

INC  R0

ADD  A,@R0

XCH  A,R4

ADDC  A,#0

MOV  R3,A

DJNZ  R2,LP

RET

BJ:MOV  30H,#0

MOV  A,40H

CLR  C

SUBB  A,52H

JC  XX

SETB  P1.4

RET

XX:MOV  A,40H

CLR  C

SUBB  A,53H

JNC  WW

CLR  P1.4

WW:RET

Q1:MOV  DPTR,#TABLE

MOV  A,R3

CLR  C

RLC  A

MOV  R3,A

XCH  A,R2

RLC  A

XCH  A,R2

ADD  A,DPL

MOV  DPL,A

MOV  A,DPH

ADDC  A,R2

MOV  DPH,A

CLR  A

MOVC  A,@A+DPTR

MOV  R2,A

CLR  A

INC  DPTR

MOVC  A,@A+DPTR

MOV  R3,A

RET

TABLE:  DW  000,045,051,056,062,066

DW  070,074,081,086,092

DW  098,100,105,110,116

DW  121,124,130,135,138

DW  142,146,151,154,160

DW  165,168,170,175,178

DW  180,184,190,193,195

DW  208,214,220,224,229

DW  232,238,242,250,255

DW  260,264,271,275,280

DW  284,292,294,295,300

DW  306,311,316,321,325

DW  330,334,338,343,347

DW  350,355,360,362,364

DW  366,368,370,375,376

DW  378,379,380,382,384

DW  385,387,388,389,390

DW  392,395,396,399,400

DW  402,403,405,406,408

DW  410,412,414,416,418

DW  419,420,422,423,425

DW  427,428,430,432,436

DW  438,439,440,442,444

DW  445,446,449,450,452

DW  438,440,442,446,448

DW  450,452,453,455,456

DW  458,461,463,465,468

DW  468,470,472,475,478

DW  480,480,482,485,485

DW  488,490,491,493,495

DW  498,500,500,501,504

DW  505,508,510,512,515

DW  518,518,522,524,528

DW  532,536,540,540,545

DW  548,549,551,554,556

DW  559,560,562,565,568

DW  570,572,573,575,578

DW  580,583,585,588,590

DW  595,596,598,600,602

DW  608,610,610,612,615

DW  620,623,625,628,630

DW  632,635,640,642,645

DW  648,650,652,655,658

DW  660,664,665,668,672

DW  675,677,680,685,688

DW  690,695,700,705,710

DW  712,715,718,720,725

DW  769,773,775,780,782

DW  810,815,818,820

Ndiv1:MOV  A,R3

CLR  C

SUBB  A,R7

MOV  A,R2

SUBB  A,R6

JNC  NDVE1

MOV  B,#16

NDVL1:CLR  C

MOV  A,R5

RLC  A

MOV  R5,A

MOV  A,R4

RLC  A

MOV  R4,A

MOV  A,R3

RLC  A

MOV  R3,A

XCH  A,R2

RLC  A

XCH  A,R2

MOV  F0,C

CLR  C

SUBB  A,R7

MOV  R1,A

MOV  A,R2

SUBB  A,R6

JB  F0,NDVM1

JC  NDVD1

NDVM1:MOV  R2,A

MOV  A,R1

MOV  R3,A

INC  R5

NDVD1:DJNZ  B,NDVL1

CLR  F0

RET

NDVE1:SETB  F0

RET


自己对照着慢慢一点一点的写注释。这种工作,别人不可能帮你的。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top