在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)打鈴器設(shè)計(jì)

            單片機(jī)打鈴器設(shè)計(jì)

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


            fycz: dec r23
            brne gzcsxs1
            rcall EERead
            cpi r16,0
            brne fycz1
            inc r22
            cpi r22,4
            brmi fycz2
            clr r22
            fycz1: inc r25
            cpi r25,32
            brmi fycz2
            clr r25
            fycz2: rjmp gncs

            bzcz: dec r24
            brne gzcsxs1
            cpi r22,0
            brne bzcz2
            bzcz1: rcall EERead
            cpi r16,0
            breq bzcz11
            clr r16
            rjmp bzcz12
            bzcz11: ldi r16,1
            bzcz12: rcall EEWrite
            rjmp gncs
            bzcz2: add r17,r22
            rcall EERead
            inc r16
            cpi r22,1
            breq bzcz21
            cpi r16,60
            brmi bzcz22
            clr r16
            rjmp bzcz22
            bzcz21: cpi r16,24
            brmi bzcz22
            clr r16
            bzcz22: rcall EEWrite
            sub r17,r22
            rjmp gncs

            ;****顯示子程序************************************************
            ;*
            ;* 功能:將SRAM顯示緩沖區(qū)存放的數(shù)送數(shù)碼管顯示
            ;* 入口:DISBUF---顯示緩沖區(qū)起始地址(SRAM)
            ;* Y--顯示緩沖區(qū)的指針
            ;* DISTBL---顯示字符編碼表起始地址(FLASH)
            ;* LEDSXW---LED閃顯寄存器位設(shè)置
            ;* XSDBZ----小數(shù)點(diǎn)設(shè)置
            ;* 出口:Y--顯示緩沖區(qū)的指針,指向高地址
            ;*
            ;****程序段
            display: nop
            push temp
            push temp1
            push temp2
            push temp3
            push temp4
            push r6
            ldi temp1,6
            ldi temp3,0b11011111
            ldi yl,low(DISBUF)
            ldi yh,high(DISBUF)
            ldi xl,low(XSDBZ)
            clr xh
            ld r6,x
            disp1: ld temp,y+
            ldi zl,low(DISTBL)
            ldi zh,high(DISTBL)
            add zl,temp
            lsl zl
            rol zh
            lpm
            lsr r6
            brcc disp2
            ldi temp4,0b10000000
            or r0,temp4
            disp2: out PORTC,r0
            in temp2,PORTA
            ori temp2,0b00111111
            and temp2,temp3
            out PORTA,temp2
            sec
            ror temp3
            rcall delay
            in temp2,PORTA
            ori temp2,0b00111111
            out PORTA,temp2 ;關(guān)顯示
            dec temp1
            brne disp1
            pop r6
            pop temp4
            pop temp3
            pop temp2
            pop temp1
            pop temp
            ret

            ;****時(shí)鐘顯示子程序************************************************
            colodis: push temp
            ldi yl,low(DISBUF) ;設(shè)置顯示緩沖區(qū)起始地址
            clr yh
            ldi xl,low(TIMEDIS) ;設(shè)置時(shí)鐘時(shí)分秒存放單元
            clr xh
            ldi zl,low(XSDBZ)
            clr zh
            ldi temp,0b00001010 ;b0-5對(duì)應(yīng)LED自左到右1-6位的小數(shù)點(diǎn),置“1”在該位置小數(shù)點(diǎn)。
            st z,temp
            rcall ram6ram
            rcall display
            pop temp
            ret

            ;****延時(shí)子程序**************************************************

            delay: nop ;延時(shí)子程序
            push temp2
            push temp1
            ldi temp2,$ff
            lp1: ldi temp1,$f
            lp2: dec temp1
            brne lp2
            dec temp2
            brne lp1
            pop temp1
            pop temp2
            ret ;子程序返回

            ;****寫(xiě)EEPRON子程序************************************************
            ;*
            ;*功能:將EEDWR(r16)內(nèi)容寫(xiě)入以EEAWR(r18:r17)內(nèi)容為地址的EEPRON單元內(nèi)。
            ;*
            ;****程序段
            EEWrite:sbic EECR,EEWE
            rjmp EEWrite
            out EEARH,EEawrh
            out EEARL,EEawr
            out EEDR,EEdwr
            sbi EECR,EEMWE
            sbi EECR,EEWE
            ret

            ;****讀EEPRON子程序*************************************
            ;*
            ;*功能:從以EEARD(r18:r17)內(nèi)容為地址的EEPRON單元讀區(qū)內(nèi)容送EEDRD(r16)寄存器。
            ;*
            ;****程序段
            EERead: sbic EECR,EEWE
            rjmp EERead
            out EEARH,EEardh
            out EEARL,EEard
            sbi EECR,EERE
            sbi EECR,EERE
            in EEdrd,EEDR
            ret

            ;****6字節(jié)SRAM內(nèi)容傳送子程序************************************************************
            ;*
            ;* 功能:將SRAM內(nèi)連續(xù)6字節(jié)由BLOCK1傳送到BLOCK2
            ;* x---欲傳送6字節(jié)起始地址(SRAM)指針
            ;* y---欲放置6字節(jié)起始地址(SRAM)指針
            ;*
            ;****程序段
            ram6ram:push temp1
            push temp2
            ldi temp1,$06
            ramd1: ld temp2,x+
            st y+,temp2
            dec temp1
            brne ramd1
            pop temp2
            pop temp1
            ret

            ;****8位二進(jìn)制數(shù)轉(zhuǎn)3位BCD數(shù)子程序********************************************************
            ;*
            ;*功能:把一個(gè)8位無(wú)符號(hào)二進(jìn)制數(shù)轉(zhuǎn)換為3位BCD碼數(shù)。
            ;*入口:r16---內(nèi)裝8位無(wú)符號(hào)二進(jìn)制數(shù)。
            ;*出口:BCD碼放在r2:r3:r4,r2存放百位。
            ;*
            ;****程序段

            bt push r16
            clr r2
            clr r3
            clr r4
            rjmp bto2
            bto1: inc r2
            bto2: subi r16,100
            brpl bto1
            ldi temp,100
            add r16,temp
            rjmp bto4
            bto3: inc r3
            bto4: subi r16,10
            brpl bto3
            ldi temp,10
            add r16,temp
            mov r4,r16
            pop r16
            ret
            ;****時(shí)鐘0中斷服務(wù)程序******************************************************

            .org $0bf0
            TIM0_OVF: push temp
            ldi temp,256-195
            out tcnt0,temp ;重裝T0時(shí)間常數(shù)
            inc cntms
            mov temp,cntms
            cpi temp,40
            brne timecunt
            clr cntms
            inc second
            mov temp,second
            cpi temp,60
            brne timecunt
            clr second
            ldi TIM0INT,1
            inc minute
            mov temp,minute
            cpi temp,60
            brne timecunt
            clr minute
            inc hour
            mov temp,hour
            cpi temp,24
            brne timecunt
            clr hour
            timecunt: ldi xl, low(TIMEDIS)
            clr xh
            mov r16,hour
            rcall bto
            st x+,r3
            st x+,r4
            mov r16,minute
            rcall bto
            st x+,r3
            st x+,r4
            mov r16,second
            rcall bto
            st x+,r3
            st x+,r4
            pop temp
            reti

            ;****字形表**********************************************
            .cseg
            .org DISTBL
            .dw 0x003f,0x0006,0x005b,0x004f,0x0066,0x006d,0x007d,0x0007,0x007f,0x006f
            .dw 0x0077,0x007c,0x0039,0x005e,0x0079,0x0071,0x0073,0x0076,0x0058,0x0038
            .dw 0x005c,0x0067,0x0050,0x006e,0x0078,0x0000,0x0054,0x0040,0x0074,0x0000


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

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

            評(píng)論


            相關(guān)推薦

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

            關(guān)閉