您的位置 首页 系统

把戏流水灯的规划3(单片机-汇编)

;Thisprogramwillshowyoucycleglitterbetween8ledlamps;maker:ChenWeiwu;date:2012-11-08;

;This program will show you cycle glitter between 8 led lamps

;     maker:Chen Weiwu;     date:2012-11-08;     version:1.0.0;-------------------------------------------------------------;DefineLedprt     equ          p0SegDisplay   equ          p2Button     equ        p1;----------------------;Set the initiation address which the program runing;----------------------org        0ajmp       main;-----------------------      Cycle:mov        a,#low(Tables)add        a,r1mov        dpl,aclr        aaddc       a,#high(Tables)mov        dph,aclr        amovc       a,@a+dptrmov        dpl,a ;----------------------clr        amovc       a,@a+dptr           ;Get the count of data in tablemov        r0,ainc        dptr;----------------------Loop:     mov        a,button         ;buttion is unablecpl        a        jz        ExitCycleclr        amovc       a,@a+dptrmov         Ledprt,aacall       delayinc        dptrdjnz       r0,LoopExitCycle:ret;-----------------------;-----------------------;delay subdelay:     mov        r5,#50delay1:     mov        r6,#100DELAY2:     mov        r7,#10djnz       r7,$djnz       r6,delay2djnz       r5,delay1ret;-----------------------Tables:     dw        Table1,Table2,Table3,Table4,0;-----------------------Table1:     db        Table2-$-1db        11111110bdb        11111101bdb        11111011bdb        11110111bdb        11101111bdb        11011111bdb        10111111bdb        01111111bTable2:     db        Table3-$-1db        01111110bdb        10111101bdb        11011011bdb        11100111bdb        11011011bdb        10111101bTable3:     db        Table4-$-1   db        01010101bdb        00000000bdb        10101010bdb        00000000b Table4:     db        TableEnd-$-1db        11111110bdb        11111100bdb        11111000bdb        11110000bdb        11100000bdb        11000000bdb        10000000bdb        00000000b         db        00000001bdb        00000011bdb        00001111bdb        00011111bdb        00111111bdb        01111111bdb        11111111b                      TableEnd:;-----------------------main: mov        Ledprt,#11111111B         mov        r2,#0mov        r3,#01111111bmov        SegDisplay,#00H      ;Initiate the SegDisplayToNext:cjne       r2,#5,ToNext1ajmp       MainToNext1:inc        r2            ;Button Numbermov        a,r3rl        a       mov        r3,acjne       a,button,ToNext      ;Check whether the button is enable or notmov        SegDisplay,r2       ;button is enable,Show on the SegDisplaymov        a,r2rl        aclr        csubb       a,#1           ;Location in the Tablesmov        r1,amov        a,r3cjne       a,button,mainacall       Cycle    ajmp       Main;-----------------------end;------------------------------------------------------------

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/xitong/255697.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部