<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 單片機打鈴器設計

單片機打鈴器設計

作者: 時(shí)間:2013-03-12 來(lái)源:網(wǎng)絡(luò ) 收藏

;**** 設計 **************************************************
;* 編號:LRDZAVR0100 
;* 標題: 32點(diǎn)例程
;* 文件名:timecontr.asm
;* 版本: 1.0
;* 開(kāi)始日期: 02.06.13
;* 目標MCU:
;* 技術(shù)支持: http://www.dianz.cn
;* 硬件結構: PA0-5對應6個(gè)LED數顯管的位 ,PC0-7對應各LED數顯管的段 ,PB4-7為鍵盤(pán)。
;* 軟件描述: 上電后,時(shí)鐘從00.00.00(時(shí)/分/秒)自動(dòng)走時(shí),在走時(shí)狀態(tài)時(shí) , 按PB4(設定
;* 鍵)超過(guò)3秒可循環(huán)選擇調整時(shí)間/工作參數 ,接著(zhù)按PB5以確定選擇的操作 ,進(jìn)入調整操作后 ,
;* 按PB5選擇欲調整參數,按PB6(增加鍵)完成調整參數操作 。按PB7,進(jìn)入時(shí)控運行,PB1亮,
;* 再按PB7停止時(shí)控運行,回顯走時(shí)。在定時(shí)到時(shí),PB0點(diǎn)亮。
;******************************************************

.device
.include "8515def.inc"
.equ DISBUF = $0060 ;顯示緩沖區起始地址
.equ TIMEDIS = $0066 ;時(shí)鐘時(shí)分秒存放單元
.equ XSDBZ = $0073 ;小數點(diǎn)位標志
.equ DISTBL = $0f00 ;顯示字符編碼表起始地址
.equ TIMECTR = $0010 ;32段時(shí)間控制表首址(EEPRON)
.equ TIMECBZ = $0080 ;控制時(shí)間到標志
.cseg
.org $0000
rjmp RESET
.org $0007
rjmp TIM0_OVF

;****設計主程序*****************************************************

.def cntms =r9
.def hour =r10
.def minute =r11
.def second =r12
.def EEdwr =r16
.def EEawr =r17
.def EEawrh =r18
.def EEdrd =r16
.def EEard =r17
.def EEardh =r18
.def temp =r20
.def temp1 =r21
.def temp2 =r22
.def temp3 =r23
.def temp4 =r24
.def TIM0INT =r19

.org $0020
RESET: ldi temp,low(ramend) ;設置堆棧指針
out spl,temp
ldi temp,high(ramend)
out sph,temp
ldi temp,0b11111111 ;設置各口線(xiàn)輸入輸出狀態(tài)
out ddra,temp
ldi temp,0b00000011
out ddrb,temp
ldi temp,0b11111111
out ddrc,temp
ldi zl,TIMECBZ
clr zh
clr temp
st y,temp
clr r9 ;清各工作寄存器
clr r10
clr r11
clr r12
clr r13
clr r14
clr r15
clr r16
clr r17
clr r18
clr r19
clr r25
ldi temp,$5
out tccr0,temp ;T0設置ck/1024分頻
ldi temp,256-195
out tcnt0,temp ;裝T0時(shí)間常數
res1: ldi temp,$02 ;允許T0中斷,并計時(shí)
out timsk,temp
sei ;開(kāi)中斷
res2: clr r6
clr r7
sbi PORTb,1
sbi PORTB,0
res3: ldi temp,$af
res4: rcall colodis ;時(shí)鐘走時(shí)顯示
dec temp
brne res4
sbis pinb,7 ;鍵掃描
rjmp PB7M
sbis pinb,4
rjmp BP4M ;去參數設置
rjmp res3

;****《系統功能程序》

.org $0080 ;定義系統功能程序存放區首址

;****32點(diǎn)打鈴器工作程序*******************************************************

PB7M: cbi PORTb,1 ;置運行指示燈亮
clr r25
clr r7
GNCX11:ldi r17,TIMECTR ;首個(gè)控制點(diǎn)EEPRON地址
clr r18
lsl r25
lsl r25
add r17,r25 ;取得EEPRON中控制點(diǎn)地址(Aj=A0+4*j),A=(r17),j=(r25)
lsr r25
lsr r25
rcall EERead
cpi r16,0
breq GNCX12 ;r16=(r17)=0為“ON”
inc r25
cpi r25,31
brmi GNCX11
rjmp GNCX16
GNCX12:inc r17
rcall EERead
cp r16,r10
brne GNCX13
inc r17
rcall EERead
cp r16,r11
brne GNCX14
inc r17
rcall EERead
mov r7,r16
inc r7
cbi PORTb,0
rjmp GNCX15
GNCX13:dec r17
inc r25
rjmp GNCX11
GNCX14:dec r17
dec r17
inc r25
rjmp GNCX11
GNCX15:cpi TIM0INT,1
brne GNCX17
clr TIM0INT
dec r7
brne GNCX17
clr r7
sbi PORTb,0
rjmp GNCX16
GNCX17:rcall colodis
sbic pinb,7
rjmp GNCX15
rjmp res2
GNCX16:ldi temp,$5f
GNCX18:rcall colodis
dec temp
brne GNCX18
sbic pinb,7
rjmp GNCX11
rjmp res2

;****打鈴器參數設置

BP4M: ldi temp3,$ff
ldi temp4,$f
BP4M1: nop
rcall colodis
sbic pinb,4
rjmp res1
dec temp3 ;PB4有按下
brne BP4M1
inc temp3
dec temp4
brne BP4M1
ldi temp3,$ff ;超3秒進(jìn)入
ldi temp4,$f
BP4M2: clr yh
ldi yl,low(DISBUF) ;設置顯示cloc.
ldi temp,25
st y+,temp
st y+,temp
ldi temp,18
st y+,temp
ldi temp,19
st y+,temp
ldi temp,20
st y+,temp
ldi temp,18
st y,temp
ldi zl,low(XSDBZ)
clr zh
ldi temp,0b00100000 ;b0-5對應LED自左到右1-6位的小數點(diǎn),置“1”在該位置小數點(diǎn)。


上一頁(yè) 1 2 3 下一頁(yè)

關(guān)鍵詞: 單片機 打鈴器 AT90S8515

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>