花样流水灯的设计3(单片机-汇编)
时间:11-29
来源:互联网
点击:
;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;------------------------------------------------------------
花样流水灯单片机汇 相关文章:
- 花样流水灯的设计2(单片机-汇编)(11-30)
- 花样流水灯的设计4(单片机-汇编)(11-30)
- 花样流水灯的设计1(单片机-汇编)(11-29)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)