8051单片机 电动机的控制.docx

上传人:b****3 文档编号:26702396 上传时间:2023-06-21 格式:DOCX 页数:12 大小:14.80KB
下载 相关 举报
8051单片机 电动机的控制.docx_第1页
第1页 / 共12页
8051单片机 电动机的控制.docx_第2页
第2页 / 共12页
8051单片机 电动机的控制.docx_第3页
第3页 / 共12页
8051单片机 电动机的控制.docx_第4页
第4页 / 共12页
8051单片机 电动机的控制.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

8051单片机 电动机的控制.docx

《8051单片机 电动机的控制.docx》由会员分享,可在线阅读,更多相关《8051单片机 电动机的控制.docx(12页珍藏版)》请在冰豆网上搜索。

8051单片机 电动机的控制.docx

8051单片机电动机的控制

ORG0000H

LJMPMAIN

ORG0003H

LJMPLN1

ORG0030H

MAIN:

MOVSCON,#00H

MOVDPTR,#TABLE

CLRES

MOVA,#0

MOVCA,@A+DPTR

CLRTI

MOVSBUF,A

JNBTI,$

CLRTI

MOVSBUF,A

JNBTI,$

MAIN1:

MOVP2,#00H

MOVP1,#0FFH

MOVP0,#0FFH

MOVR7,#15

MOVSP,#60H

MOVR3,#0

MOVR4,#0

SETBIT0

SETBEA

SETBEX0

JBP1.4,KEY

LCALLZHENG

KEY:

JBP1.5,KEY0

LCALLFAN

KEY0:

LJMPMAIN1

 

ZHENG:

JBP1.0,$

SETBP2.4

Z0:

JBP1.1,KEY11

LJMPNEXT11

KEY11:

JBP1.6,KEY21

MOVR3,#0

MOVR4,#1

LCALLZHENG1

KEY21:

JBP1.7,KEY31

MOVR3,#1

MOVR4,#0

LCALLZHENG1

KEY31:

JBP0.0,KEY41

LJMPMAX

KEY41:

JBP0.1,NEXT1

LJMPMIN

NEXT1:

CLRP2.2

LCALLDELAY1

SETBP2.0

LCALLDELAY1

SETBP2.1

LCALLDELAY1

CLRP2.0

LCALLDELAY1

SETBP2.2

LCALLDELAY1

CLRP2.1

LCALLDELAY1

SETBP2.0

LCALLDELAY1

LJMPZ0

NEXT11:

RET

 

FAN:

JBP1.0,$

SETBP2.6

JIU0:

JBP1.1,KEY12

LJMPNEXT12

KEY12:

JBP1.6,KEY22

MOVR3,#0

MOVR4,#1

LCALLFAN1

KEY22:

JBP1.7,KEY32

MOVR3,#1

MOVR4,#0

LCALLFAN1

KEY32:

JBP0.0,KEY42

LJMPMAX

KEY42:

JBP0.1,NEXT2

LJMPMIN

NEXT2:

CLRP2.1

LCALLDELAY1

SETBP2.0

LCALLDELAY1

SETBP2.2

LCALLDELAY1

CLRP2.0

LCALLDELAY1

SETBP2.1

LCALLDELAY1

CLRP2.2

LCALLDELAY1

SETBP2.0

LCALLDELAY1

LJMPJIU0

NEXT12:

RET

 

ZHENG1:

JBP1.1,KEY1

LJMPNEXT111

KEY1:

JBP0.0,KEY4

LJMPMAX

KEY4:

JBP0.1,NEXT

LJMPMIN

NEXT:

CLRP2.3

SETBP2.0

CJNER3,#0,Z1

CJNER4,#0,Z2

SETBP2.1

CJNER3,#0,Z1

CJNER4,#0,Z2

CLRP2.0

CJNER3,#0,Z1

CJNER4,#0,Z2

SETBP2.2

CJNER3,#0,Z1

CJNER4,#0,Z2

CLRP2.1

CJNER3,#0,Z1

CJNER4,#0,Z2

SETBP2.0

CJNER3,#0,Z1

CJNER4,#0,Z2

LJMPZHENG1

Z1:

LJMPDELAY0

Z2:

LJMPDELAY2

NEXT111:

LJMPMAIN

FAN1:

JBP1.1,KEY111

LJMPNEXT112

KEY111:

JBP0.0,KEY411

LJMPMAX

KEY411:

JBP0.1,NEXT114

LJMPMIN

NEXT114:

SETBP2.0

CLRP2.1

CJNER3,#0,Z11

CJNER4,#0,Z22

SETBP2.2

CJNER3,#0,Z11

CJNER4,#0,Z22

CLRP2.0

CJNER3,#0,Z11

CJNER4,#0,Z22

SETBP2.1

CJNER3,#0,Z11

CJNER4,#0,Z22

CLRP2.2

CJNER3,#0,Z11

CJNER4,#0,Z22

SETBP2.0

CJNER3,#0,Z11

CJNER4,#0,Z22

LJMPFAN1

Z11:

AJMPDELAY0

Z22:

AJMPDELAY2

NEXT112:

LJMPMAIN

MAX:

SETBP2.3

SETBP2.7

DIAOY1:

LCALLDINGSHI

LCALLDELAY3

DECR7

CPLP2.3

CJNER7,#0,DIAOY1

MOVP2,#00H

LJMPMAIN

MIN:

SETBP2.5

SETBP2.7

DIAOY2:

LCALLDINGSHI

LCALLDELAY3

DECR7

CPLP2.3

CJNER7,#0,DIAOY2

MOVP2,#00H

LJMPMAIN

DINGSHI:

JBP1.1,KEY512

LJMPNEXT512

KEY512:

MOVA,R7

MOVB,#10

MOVSCON,#00H

MOVDPTR,#TABLE

DIVAB

CLRES

CLRTI

MOV25H,A

MOVA,B

MOVCA,@A+DPTR

MOVSBUF,A

JNBTI,$

CLRTI

MOVA,25H

MOVCA,@A+DPTR

MOVSBUF,A

JNBTI,$

NEXT512:

RET

 

DELAY2:

MOVTMOD,#01H

LOOP:

MOVTH0,#3CH

MOVTL0,#0B0H

MOVIE,#00H

SETBTR0

JNBTF0,$

CLRTF0

RET

DELAY1:

MOVR5,#2

MOVTMOD,#01H

LOOP1:

MOVTH0,#3CH

MOVTL0,#0B0H

MOVIE,#00H

SETBTR0

JNBTF0,$

CLRTF0

DJNZR5,LOOP1

RET

DELAY0:

MOVR5,#3

MOVTMOD,#01H

LOOP2:

MOVTH0,#3CH

MOVTL0,#0B0H

MOVIE,#00H

SETBTR0

JNBTF0,$

CLRTF0

DJNZR5,LOOP2

RET

DELAY3:

MOVR5,#20

MOVTMOD,#01H

LOOP3:

MOVTH0,#3CH

MOVTL0,#0B0H

MOVIE,#00H

SETBTR0

JNBTF0,$

CLRTF0

DJNZR5,LOOP3

RET

DINGSHI1:

MOVA,11H

MOVB,#10

DIVAB

MOV12H,A

MOVA,B

MOVSCON,#00H

MOVDPTR,#TABLE1

CLRES

CLRTI

MOVCA,@A+DPTR

MOVSBUF,A

JNBTI,$

MOVA,12H

CLRTI

MOVDPTR,#TABLE

MOVCA,@A+DPTR

MOVSBUF,A

JNBTI,$

RET

 

LN1:

PUSH05H

SETBP2.7

SETBP2.6

MOV11H,#99

FENG1:

LCALLDINGSHI1

LCALLDELAY2

DEC11H

CPLP2.6

MOVA,11H

JNBP1.2,CTSWIN

CJNEA,#0FFH,FENG1

CTSWIN:

POP05H

RETI

TABLE:

DB0FCH,60H,0DAH,0F2H,66H,0B6H,0BEH,0E0H,0FEH,0F6H

TABLE1:

DB0FDH,61H,0DBH,0F3H,67H,0B7H,0BFH,0E1H,0FFH,0F7H

END

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 其它课程

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1