资源描述:
《单片机艺术流水灯程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、单片机原理及应用大作业艺术灯流水设计一、实现功能扌恩下开关后,8个艺术灯从第8个灯开始依次只灭一个,然后依次全灭,Z后奇数灯先亮,然后全亮。中断模块:外部中断和串行通讯中断。定时器模块:串行通讯时钟串行通讯模块:1#单片机P3.3口设置开关,2#单片机的P0口连接8个LED灯。当开关按下,1#单片机向2#单片机发出指令,从而控制艺术灯的闪烁。二、汇编程序orgOOOOhIjmpmainorg0003hIjmpmain2main:setbexOsetbitOsetbeasjmp$main2:movscon,#40Hmovtmod,#20HmovTH1Z#OfDHmovTLl,#OfDHmov
2、RO,#3OHMOVR7z#10HMOV30H,#10000000Bmov31h,#OlOOOOOOBmov32h,#OOlOOOOOBmov33h,#00010000Bmov34h,#00001000Bmov35h,#OOOOOlOOBmov36h,#00000010Bmov37h,#00000001Bmov38h,#00000011Bmov39h,#00000111Bmov3Ah,#00001111Bmov3Bhz#00011111Bmov3Chz#00111111BmovSDh^OlllllllBmovSEh^llllllllBmov3Fh,#10101010Bsetbtriloop
3、l:movA,@ROmovSBUF,AIcalldelayIcalldelayIcalldelayIcalldelayloopJNBTIJoopclrTIINCRODJNZR7,LOOP1SJMP$delay:movr7,#200dlyl:movr6,#123dly2:djnzr6,dly2nopdjnzr7zdlylretend接受orgOOOOh1jmpmainorg0023h1jmpserialorg0030hmain:movscon,#50Hmovtmod,#20HmovTHl,#0fDhmovTL1,#OfDhsetbtrisetbessetbeamovRO,#3011sjmp$
4、serial:CLRRImovA,sbufmov@R0,AmovpO,@r0leal1delaylcalldelayleal1delaylcalldelayincrOretidelay:movr7,#200dlyl:movr6,#123dly2:djnzr6,dly2nopdjnzr7,dlylretend三、仿真结果启动程序,8个艺术灯从第8个灯开始依次只灭一个,然后依次全灭,之后奇数灯先亮,然后全亮。新TIVProteus8Profeisioni(BETA):it5、(Y)JdWW(2S2<«Bd)*❼曲汩♦9V.9
6、:.dC*XM-aISamKM■・•—■■>l>I■O卩心乂D(K」gHOM*斷工程Proteus8Professional(BETA)女*r)(MR)«B(Y)UKT)#tt(N)BRG)ZD)Jt(Ufv)■動M)邓0口d■奄❼S♦♦aJC七:?4J•*.M■ul>■4・・i>uo・"w/・・、・A・・co^t»«ilff・Proteus8Profewonal(BETA)KWhMwnMknwrv)nun)・gkd)«a)m*M)m((v)■爸切[JW却❼;♦・乂04・八••七KJ.-,cxm).l>9SiZffProteus8Professiona!(BHA)文*nMK)7、T)®it(N)牛0)ltd)MOO«®>M)邓0口d■奄❼S♦♦aJC七:?4J•*.M•:5:oun0"w/・・;A・・