资源描述:
《开关控制二极管亮灭+数码管》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、开关控制二极管亮灭P1.5=1P2.1=1P1.5=0P2.1=0START:JBP1.5,LOOP;判断开关是断开还是闭合,条件是:P1.5是不是等于1CLRP2.1;闭合LJMPSTARTLOOP:SETBP2.1;断开LJMPSTARTENDSTART:JBP1.5,LOOP;判断开关是断开还是闭合,条件是:P1.5是不是等于1CLRP2.1;闭合SETBP2.2LJMPSTARTLOOP:SETBP2.1CLRP2.2LJMPSTARTENDSTART:JBP1.5,LOOPCLRP2.1JBP1.6,LOOP1CLRP2
2、.2LJMPSTARTLOOP:SETBP2.1JBP1.6,LOOP1CLRP2.2LJMPSTARTLOOP1:SETBP2.2LJMPSTARTENDStart:Jbp1.5,dianqiClrp2.1Loop1:Djnzr0,loop1Djnzr1,loop1Setbp2.1Loop2:Djnzr0,loop2Djnzr1,loop2LjmpstartDianqi:Setbp2.1Ljmpstartend课题151.300Ω2.标注端口开始3.P2.0=1?否Y有,D1闪烁无,D2闪烁4.题库3P0.0P0.1P2.0P1
3、.1P1.0启动报警P1.0=1P1.1=0P2.0=1延时P1.0=0P1.1=1P2.0=0延时开始是SW2是否断开P0.1=1?是SW1是否闭合P0.0=0?否否灯灭P1.0=1P1.1=1扬声器不亮P2.0=0P1.0P3.1START:JNBP0.0,BAOJINGJBP0.1,BAOJINGSETBP1.0SETBP1.1clrP2.0LJMPSTARTBAOJING:SETBP1.0CLRP1.1ClrP2.0LOOP:DJNZR0,LOOPDJNZR1,LOOPCLRP1.0SETBP1.1SETBP2.0LOOP
4、1:DJNZR0,LOOP1DJNZR1,LOOP1LJMPstartEND裁判表决器Start:Jbp1.5,biaojue;开关断开P1.5=1,条件成立,跳转到biaojue,二极管不亮,P2.1=1开关闭合P1.5=0,条件不成立,不跳转,继续判断第二个开关Jbp1.6,biaojue;开关断开P1.6=1,条件成立,跳转biaojue,二极管不亮,P2.1=1开关闭合P1.5=0,条件不成立,不跳转,二极管亮P2.1=0clrp2.1LjmpstartBiaojue:Setbp2.1LjmpstartEnd课题4STAR
5、T:JBP1.5,CHENGJBP1.6,ZHANGCLRP2.1MovR7,#10LOOP:CLRP2.2DAL:DJNZR0,DALDJNZR1,DALSETBP2.2DAL1:DJNZR0,DAL1DJNZR1,DAL1DJNZR7,LOOPLJMPDONECHENG:SETBP2.1CLRP2.2DAL2:DJNZR0,DAL2DJNZR1,DAL2SETBP2.2DAL3:DJNZR0,DAL3DJNZR1,DAL3LJMPSTARTZHANG:JBP1.7,GAOCLRP2.1;P2.1是灯MovR7,#10LOOP1
6、:CLRP2.2DAL4:DJNZR0,DAL4DJNZR1,DAL4SETBP2.2DAL5:DJNZR0,DAL5DJNZR1,DAL5DJNZR7,LOOP1LJMPDONEGAO:SETBP2.1CLRP2.2DAL5:DJNZR0,DAL5DJNZR1,DAL5SETBP2.2DAL6:DJNZR0,DAL6DJNZR1,DAL6LJMPSTARTDONE:END数码管共阴数码管任务1:显示dq3112MovP1,#06H;1字模MOVP2,#01HEND课题141.2.Y显示FN显示E初始化Y按键?P1.0=0?按键?
7、P1.0=0?N3.4.E\2011…..5.计数器DIANQI:MOVr7,#0MOVDPTR,#YINJUNStart:JNBP0.4,LOOPLJMPSTARTLOOP:DAL:DJNZR0,DALDJNZR1,DALMovA,R7MOVCA,@A+DPTRINCR7MOVP1,AMovP2,#01HCJNER7,#10H,STARTLJMPDIANQIYINJUN:DB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,END课题8YN显示十位显示个位初始化按键?P0.0=0?NY是否>9?M
8、OVr6,#0MOVDPTR,#YINJUNDIANQI:MOVr7,#0Start:JNBP0.4,TIAOYONGMOVP1,R5MovP2,#01HDAL1:DJNZR0,DAL1MOVP1,R4MovP2,#02HLJMPSTARTTIAO