在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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)用 > 用AVR單片機(jī)模擬的串口程序

            用AVR單片機(jī)模擬的串口程序

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

            >>>>>>>>>>>>>>>>>>>>>>>>>>
            ;receivestart1bitdata8bitstop1bit
            timer0_receive:
            cpibit_cnt,1;ifbit_cnt=1thenstartbit
            breqtimer0_receive_start
            cpibit_cnt,10;ifbit_cnt=10thenstopbit
            breqtimer0_receive_stop

            rjmptimer0_receive_data
            timer0_receive_start:
            sbispind,rxd0
            rjmptimer0_end

            cbrstatus,(1rdr);startbitwrongthenrdr=0exit
            rjmptimer0_complete
            timer0_receive_data:
            sec
            sbispind,rxd0;getrxd0data
            clc
            rorsbuf0
            rjmptimer0_end
            timer0_receive_stop:
            cbrstatus,(1fe0);ifstopbit=0thenfe0=0
            sbispind,rxd0
            rjmptimer0_complete
            sbrstatus,(1fe0)
            sbrstatus,(1rdr);rdr=1
            ;>>>>>>>>>>>>>>>>>>>>>>>>>>
            timer0_complete:
            intemp,timsk
            cbrtemp,(1toie0)
            outtimsk,temp;disabletimsk/toie0
            ;;;;;;;;;;;;;;;;;;;
            intemp,gifr
            sbrtemp,(1intf0)
            outgifr,temp;clrint0flag

            intemp,gimsk
            sbrtemp,(1int0)
            outgimsk,temp;enablegimsk/int0

            cbrstatus,(1busy)|(1td);busy=0,td=0
            timer0_end:
            poptemp
            outsreg,temp
            poptemp

            reti
            ;******************************************
            int00:
            pushtemp
            intemp,sreg
            pushtemp

            lditemp,(256-N/2);skip0.5bit
            outTCNT0,temp

            ldistatus,(1busy);busy=1,rdr=0,td=0,fe0=0
            clrbit_cnt

            intemp,tifr
            sbrtemp,(1tov0)
            outtifr,temp;clrtifr/tov0

            intemp,timsk
            sbrtemp,(1toie0)
            outtimsk,temp;enabletimsk/toie0

            intemp,gimsk
            cbrtemp,(1int0)
            outgimsk,temp;disablegimsk/int0

            poptemp
            outsreg,temp
            poptemp
            reti
            ;**********************************************************

            rxd0_data:
            txd0_data:
            ldistatus,(1busy)|(1td);busy=1,td=1,rdr=0

            pushtemp
            intemp,gimsk
            cbrtemp,(1int0)
            outgimsk,temp;disablegimsk/int0
            poptemp

            serbit_cnt;bit_cnt=0xff
            movsbuf0,temp;senddata

            lditemp,(256-N)
            outTCNT0,temp;wait1bittimer0interrupt

            intemp,tifr
            sbrtemp,(1tov0)
            outtifr,temp;clrtifr/tov0

            intemp,timsk
            sbrtemp,(1toie0)
            outtimsk,temp;enabletimsk/toie0

            cbiportb,txd0;uartstart

            ret
            ;******************************************
            rxd0_data:
            sbrsstatus,fe0;iffe0=0thenexit
            rjmprxd0_data_end
            cbrstatus,(1rdr);rdr=0
            movtemp,sbuf0
            rxd0_data_end:
            ret
            ;******************************************

            ;uartreceivedabytsfromuartandthenreturnitfromuart0:
            ;uartreceivedabytsfromuart0andthenreturnitfromuart:
            main:
            sbicusr,rxc
            rjmpsend_115200

            sbrsstatus,rdr
            rjmpuart_end
            send_19200:
            rcallrxd0_data;getuartdatafrom19200bpsuart0

            wait2:sbisusr,udrie
            rjmpwait2
            outudr,temp;senddatato115200bpsuart
            rjmpuart_end

            send_115200:
            intemp,udr;getuartdatafrom115200bpsuart
            sbicusr,fe
            rjmpuart_end;iffeerrthenend

            wait3:sbrcstatus,td;waitsendflag
            rjmpwait3
            rcalltxd0_data;senddatato19200bpsuart0
            uart_end:
            rjmpmain
            ;**********************************************************
            .exit
            ;**********************************************************


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

            評(píng)論


            相關(guān)推薦

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

            關(guān)閉