新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 花樣流水燈的設(shè)計(jì)3(單片機(jī)-匯編)

花樣流水燈的設(shè)計(jì)3(單片機(jī)-匯編)

作者: 時(shí)間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
;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;------------------------------------------------------------


評(píng)論


技術(shù)專區(qū)

關(guān)閉