欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

專注電子技術學習與研究
當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

花樣流水燈的設計1(單片機-匯編)

作者:佚名   來源:本站原創   點擊數:  更新時間:2012年12月20日   【字體:
;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        a,#11111110B
Cycle1:     mov        Ledprt,a
        rl         a
        acall       delay
        jnb        button1,cycle1
        mov        Ledprt,#11111111B
        ret
        
;-----------------------        
Pattern2:
        mov        a,#01111111B
        mov        l1,#00000001B
        
Cycle2:     mov        l3,a
        xrl        a,l1
        mov        Ledprt,a
        mov        a,l3
        rl         a
        mov        l3,a
        mov        a,l1
        rr        a
        mov        l1,a
        mov        a,l3
        acall       delay
        jnb        button2,cycle2
        mov        Ledprt,#11111111B
        ret
;-----------------------
Pattern3:
        mov        a,#10101010B  
Cycle3:     mov        l1,a
        mov        Ledprt,a
        acall       delay
        mov        a,#11111111B
        mov        Ledprt,a
        acall       delay
        mov        a,l1
        rl         a
        jnb        button3,cycle3
        mov        Ledprt,#11111111B
        ret
;-----------------------
Pattern4:
        mov        a,#11111110B
        mov        l1,#00000001B
Cycle4:     mov        Ledprt,a
        acall       delay
        rl         a
        xrl        a,l1
        jnb        button4,cycle4
        mov        Ledprt,#11111111B
        ret
        
;-----------------------

;-----------------------
;delay section
delay:     mov        r5,#50
delay1:     mov        r6,#100
DELAY2:     mov        r7,#10
        djnz       r7,$
        djnz       r6,delay2
        djnz       r5,delay1
        ret
;-----------------------
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
;-------------------------------------------------------------
關閉窗口

相關文章