新聞中心

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

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

        作者: 時(shí)間:2016-11-30 來(lái)源:網(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
        ;-------------------------------------------------------------
        ;Define
        Ledprt equ p0
        SegDisplay equ p2
        L1 equ 30h
        l3 equ 32h
        button1 equ p1.0
        button2 equ p1.2
        button3 equ p1.4
        button4 equ p1.6
        ;----------------------
        ;Set the initiation address which the program runing
        ;----------------------
        org 0
        ajmp main
        ;----------------------
        Pattern1:
        mov dptr,#Table1
        acall Cycle
        jnb button1,Pattern1 ;Button is enable
        mov Ledprt,#11111111B ;Button is unable
        ret
        ;-----------------------
        Pattern2:
        mov dptr,#Table2
        acall Cycle
        jnb button2,Pattern2 ;Button is enable
        mov Ledprt,#11111111B ;Button is unable
        ret
        ;-----------------------
        Pattern3:
        mov dptr,#Table3
        acall Cycle
        jnb button3,Pattern3 ;Button is enable
        mov Ledprt,#11111111B ;Button is unable
        ret
        ;-----------------------
        Pattern4:
        mov dptr,#Table4
        acall Cycle
        jnb button4,Pattern4 ;Button is enable
        mov Ledprt,#11111111B ;Button is unable
        ret
        ;-----------------------
        Cycle:
        ;----------------------
        clr a
        movc a,@a+dptr
        mov r0,a
        inc dptr
        ;----------------------
        Loop:
        clr a
        movc a,@a+dptr
        mov Ledprt,a
        acall delay
        inc dptr
        djnz r0,Loop
        ret
        ;-----------------------
        ;-----------------------
        ;delay section
        delay: mov r5,#50
        delay1: mov r6,#100
        DELAY2: mov r7,#10
        djnz r7,$
        djnz r6,delay2
        djnz r5,delay1
        ret
        ;-----------------------
        Table1: db Table2-$-1
        db 11111110b
        db 11111101b
        db 11111011b
        db 11110111b
        db 11101111b
        db 11011111b
        db 10111111b
        db 01111111b
        Table2: db Table3-$-1
        db 01111110b
        db 10111101b
        db 11011011b
        db 11100111b
        db 11011011b
        db 10111101b
        Table3: db Table4-$-1
        db 01010101b
        db 00000000b
        db 10101010b
        db 00000000b
        Table4: db TableEnd-$-1
        db 11111110b
        db 11111100b
        db 11111000b
        db 11110000b
        db 11100000b
        db 11000000b
        db 10000000b
        db 00000000b
        db 00000001b
        db 00000011b
        db 00001111b
        db 00011111b
        db 00111111b
        db 01111111b
        db 11111111b
        TableEnd:
        ;-----------------------
        main: mov SegDisplay,#00H
        jb button1,To2
        mov SegDisplay,#01H
        Acall Pattern1
        To2:
        jb button2,To3
        mov SegDisplay,#02H
        Acall Pattern2
        To3:
        jb button3,To4
        mov SegDisplay,#03H
        Acall Pattern3
        To4:
        jb button4,main
        mov SegDisplay,#04H
        Acall Pattern4
        ajmp Main
        ;-----------------------
        end
        ;-------------------------------------------------------------


        評(píng)論


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

        關(guān)閉
        主站蜘蛛池模板: 莱阳市| 井陉县| 米林县| 芷江| 蕉岭县| 清河县| 和政县| 郯城县| 三门峡市| 错那县| 清镇市| 彭阳县| 文成县| 新巴尔虎右旗| 石林| 吉木萨尔县| 云阳县| 韶关市| 临江市| 西吉县| 邵东县| 黄山市| 饶河县| 宁河县| 民权县| 泽库县| 邓州市| 苗栗市| 高安市| 昭觉县| 上饶县| 叙永县| 武安市| 逊克县| 界首市| 兴国县| 巴南区| 镇康县| 蒙自县| 增城市| 武冈市|