日韩床上生活一级视频|能看毛片的操逼网站|色悠悠网站在线观看视频|国产免费观看A淫色免费|国产av久久久久久久|免费A级视频美女网站黄|国产毛片av日韩小黄片|热久久免费国产视频|中文字幕无码色色|成人在线视频99久久久

機(jī)電之家資源網(wǎng)
單片機(jī)首頁(yè)|單片機(jī)基礎(chǔ)|單片機(jī)應(yīng)用|單片機(jī)開(kāi)發(fā)|單片機(jī)文案|軟件資料下載|音響制作|電路圖下載 |嵌入式開(kāi)發(fā)
培訓(xùn)信息
贊助商
AT89C2051的AD轉(zhuǎn)換應(yīng)用實(shí)例
AT89C2051的AD轉(zhuǎn)換應(yīng)用實(shí)例
 更新時(shí)間:2009-7-9 16:50:50  點(diǎn)擊數(shù):0
【字體: 字體顏色
At89c2051 Successive Approximation A-to-D conversionNAME    SA_ADC_Test; Test program to loop on Successive Approximation A-to-D conversion.; Allows digital codes and resulting DAC output to be viewed on 'scope.        DSEG AT 0020H        ORG    0060H        ; stack originstack:        DS    0020H        ; stack depth        CSEG        ORG    0000H        ; power on/reset vector        jmp    on_reset        ORG    0003H        ; external interrupt 0 vector        reti            ; undefined        ORG    000BH        ; timer 0 overflow vector        reti            ; undefined        ORG    0013H        ; external interrupt 1 vector        reti            ; undefined        ORG    001BH        ; timer 1 overflow vector        reti            ; undefined        ORG    0023H        ; serial I/O interrupt vector        reti            ; undefined        ORG    0040H        ; begin constant data space        ORG    0080H        ; begin code space        USING    0        ; register bank zeroon_reset:        mov    sp, #(stack-1)    ; initialize stack pointer        mov    IE, #0        ; deactivate all interrupts        mov    a, #0ffh    ; deactivate output ports        mov    p1, a        ;        mov    p3, a        ;    loop:        call    ADC        ; convert        sjmp    loop        ; againADC:    ; Convert analog-to-digital.    ; Executes a successive approximation algorithm in an attempt to    ; find an eight-bit code which causes the DAC output to match the    ; unknown voltage at the comparator input. The algorithm returns    ; one of 256 values ranging from 00000000 (zero volts) to 11111111    ; (full scale). The exact correspondence between the code and input    ; voltage is determined in hardware.    ; Before the search begins, zeros are written to the DAC and the    ; comparator is checked to verify that its output is low. If it is    ; not, a code of zero is returned immediately. If the routine    ; completes and the comparator output has never gone high, a code    ; of all ones is returned, corresponding to full scale.    ; Delays have been inserted to allow for worst case op amp slew rate,    ; resulting in a conversion time of approximately 275 microseconds.    ; The code is returned in A. All other registers are preserved.        push    b        ; save        mov    b, r7        ;        push    b        ;        mov    b, #0        ; first code        call    DAC        ; write DAC        nop            ; wait for op amp to slew F.S. to zero        nop            ;   plus settling time        nop            ;     total five uS at 12 MHz        nop            ;        nop            ;        jb    p3.6, xxx    ; exit if comparator high        clr    c        ; intialize loop counter/bit mask        mov    a, #10000000b    ;    aaa:        orl    b, a        ; set bit in DAC code        call    DAC        ; try new code        nop            ; wait for op amp to slew 1/2 F.S.        nop            ;   plus settling time        nop            ;     total five uS at 12 MHz        nop            ;        nop            ;        jnb    p3.6, bbb    ; jump if voltage still low, keep bit        xrl    b, a        ; voltage too high, reset bit    bbb:        rrc    a        ; shift loop counter/bit mask        jnc    aaa        ; loop until bit in mask moves into C    xxx:        mov    a, b        ; return code in A        pop    b        ; restore        mov    r7, b        ;        pop    b        ;        retDAC:    ; Write the eight bit code in register B to the DAC.    ; The six most significant bits of the code are written to the    ; six most significant bits of port one. The two least significant    ; bits of the code are written to bits five and four of port three.    ; It is assumed that the comparator is in use, so the bits in port    ; one corresponding to the comparator inputs are set.    ; All unused bits are undisturbed.    ; No delays are included for DAC settling or op amp slewing.    ; All registers are preserved.        push    b        ; save code        orl    b, #00000011b    ; enable comparator        mov    p1, b        ; write bits seven to two        pop    b        ; restore code        mov    c, b.1        ; write bit one        mov    p3.5, c        ;        mov    c, b.0        ; write bit zero        mov    p3.4, c        ;        ret        END 
  • 上一篇: MT8880雙音頻收發(fā)器的51匯編程序
  • 下一篇: MAX7219用法
  • 發(fā)表評(píng)論   告訴好友   打印此文  收藏此頁(yè)  關(guān)閉窗口  返回頂部
    熱點(diǎn)文章
     
    推薦文章
     
    相關(guān)文章
    網(wǎng)友評(píng)論:(只顯示最新5條。)
    關(guān)于我們 | 聯(lián)系我們 | 廣告合作 | 付款方式 | 使用幫助 | 機(jī)電之家 | 會(huì)員助手 | 免費(fèi)鏈接

    點(diǎn)擊這里給我發(fā)消息66821730(技術(shù)支持)點(diǎn)擊這里給我發(fā)消息66821730(廣告投放) 點(diǎn)擊這里給我發(fā)消息41031197(編輯) 點(diǎn)擊這里給我發(fā)消息58733127(審核)
    本站提供的機(jī)電設(shè)備,機(jī)電供求等信息由機(jī)電企業(yè)自行提供,該企業(yè)負(fù)責(zé)信息內(nèi)容的真實(shí)性、準(zhǔn)確性和合法性。
    機(jī)電之家對(duì)此不承擔(dān)任何保證責(zé)任,有侵犯您利益的地方請(qǐng)聯(lián)系機(jī)電之家,機(jī)電之家將及時(shí)作出處理。
    Copyright 2007 機(jī)電之家 Inc All Rights Reserved.機(jī)電之家-由機(jī)電一體化網(wǎng)更名-聲明
    電話:0571-87774297 傳真:0571-87774298
    杭州濱興科技有限公司提供技術(shù)支持

    主辦:杭州市高新區(qū)(濱江)機(jī)電一體化學(xué)會(huì)
    中國(guó)行業(yè)電子商務(wù)100強(qiáng)網(wǎng)站

    網(wǎng)站經(jīng)營(yíng)許可證:浙B2-20080178-1