音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費(fèi)注冊(cè) 首頁(yè) | 行業(yè)黑名單 | 幫助
維庫(kù)電子市場(chǎng)網(wǎng)
技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測(cè)控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng)
驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

我的A/D為什么不工作??

作者:ferindly 欄目:單片機(jī)
我的A/D為什么不工作??
下面是我的編寫的一段程序測(cè)試一外部供電裝置的電壓狀態(tài),參考電壓為5v,不知為什么把程序下載到片子后一直沒反應(yīng)。請(qǐng)各位高手看看是拿出了毛。
STATUS           equ 03h
ADCON0         equ 08h
ADCON1         equ 88h
ADRES            equ 03h
INTCON         equ 0bh
ADbattery         equ 10h
ADAC              equ 11h
Battstatus           equ 12h
TEMP              equ 13h

       org   0x20


start:
        
        movlw  B'00001111'         ;設(shè)置端口A
        bsf    STATUS,5    
        movwf  85h
        bcf    STATUS,5
        movlw  B'00000000'
        movwf  05h
        nop
       
        clrf   ADAC
        
start1:
        clrf   ADbattery
        bsf    STATUS,5
        movlw  B'00000001'
        movwf  ADCON1

        clrf   ADRES
        bcf    STATUS,5                   
        movlw  B'01000001'                 ;通道零  開始轉(zhuǎn)換
        movwf  ADCON0                      ;設(shè)置ADCON0 開始轉(zhuǎn)換
;*********************************************************************
        call   delay
        bsf    ADCON0,2
wait2
        btfsc  ADCON0,2
        goto   wait2

;*********************************************************************
        movf   ADRES,w
        movwf  ADbattery
        sublw  B'01100110'                 ;2v's (  )compare
        btfsc  STATUS,0
        goto   exit
       
        movf   ADbattery,w
        sublw  B'01111111'                  ;2.5v's (  )compare
        btfsc  STATUS,0
        goto   exit1
        bsf    Battstatus,0
;*********************************************************************
        movf   ADbattery,w
        sublw  B'11001100'                  ;4v's ()  compare
        btfsc  STATUS,0
        goto   next3
        bsf    Battstatus,2
        bcf    06h,1
        call   delay
next3
        movf   ADbattery,w
        sublw  B'10110010'                   ;3.5v's ()  compare
        btfss  STATUS,0
        goto   sendstatus
        bcf    Battstatus,2
        bsf    06h,1
        call   delay
exit
        bcf    06h,2
exit1   bcf    Battstatus,0
        
sendstatus
        btfss  Battstatus,1
        goto   next5
        bsf    06h,6
        btfsc  Battstatus,2
        goto   next4
        bcf    06h,7
        goto   start1
next4
        bsf    06h,7
        goto   start1
next5
        bcf    06h,6
        btfsc  Battstatus,0
        goto   next6
        bcf    06h,7
        goto  start1
next6
        bsf    06h,7
        goto   start1
;*****************************************************************
delay
        movlw  02h
        movwf  TEMP
sd   
        decfsz TEMP
        goto   sd
      &
2樓: >>參與討論
ferindly
我用的是pic16711單片機(jī)
 
3樓: >>參與討論
dmcz
請(qǐng)問(wèn)你是哪里的?有機(jī)會(huì)我們可以探討探討!
我在深圳。

4樓: >>參與討論
aliner
reply
STATUS           equ 03h
ADCON0         equ 08h
ADCON1         equ 88h
ADRES            equ 03h
INTCON         equ 0bh
ADbattery         equ 10h
ADAC              equ 11h
Battstatus           equ 12h
TEMP              equ 13h

       org   0x20


start:
        
        movlw  B'00001111'         ;設(shè)置端口A
        bsf    STATUS,5    
        movwf  85h
        bcf    STATUS,5
        movlw  B'00000000'
        movwf  05h
        nop
       
        clrf   ADAC
        
        clrf   ADbattery
        bsf    STATUS,5
        movlw  B'00000010'
        movwf  ADCON1

        clrf   ADRES
        bcf    STATUS,5                   
        movlw  B'01000001'                 ;通道零  開始轉(zhuǎn)換
        movwf  ADCON0                      ;設(shè)置ADCON0 開始轉(zhuǎn)換
;*********************************************************************
        call   delay

start1:

        bsf    ADCON0,2
wait2
        btfsc  ADCON0,2
        goto   wait2

;*********************************************************************
        movf   ADRES,w
        movwf  ADbattery
        sublw  B'01100110'                 ;2v's (  )compare
        btfsc  STATUS,0
        goto   exit
       
        movf   ADbattery,w
        sublw  B'01111111'                  ;2.5v's (  )compare
        btfsc  STATUS,0
        goto   exit1
        bsf    Battstatus,0
;*********************************************************************
        movf   ADbattery,w
        sublw  B'11001100'                  ;4v's ()  compare
        btfsc  STATUS,0
        goto   next3
        bsf    Battstatus,2
        bcf    06h,1
        call   delay
next3
        movf   ADbattery,w
        sublw  B'10110010'                   ;3.5v's ()  compare
        btfss  STATUS,0
        goto   sendstatus
        bcf    Battstatus,2
        bsf    06h,1
        call   delay
exit
        bcf    06h,2
exit1   bcf    Battstatus,0
        
sendstatus
        btfss  Battstatus,1
        goto   next5
        bsf    06h,6
        btfsc  Battstatus,2
        goto   next4
        bcf    06h,7
        goto   start1
next4
        bsf    06h,7
        goto   start1
next5
        bcf    06h,6
        btfsc  Battstatus,0
        goto   next6
        bcf    06h,7
        goto  start1
next6
        bsf    06h,7
        goto   start1
;*****************************************************************
delay
        movlw  02h
        movwf  TEMP
sd   
        decfsz TEMP
        goto   sd
        return
        END


5樓: >>參與討論
ferindly
我在北京你呢?
 
6樓: >>參與討論
fangyi999
問(wèn)題解決了嗎?
 
7樓: >>參與討論
ferindly
謝謝大家的關(guān)心,問(wèn)題已得到解決
 
參與討論
昵稱:
討論內(nèi)容:
 
 
相關(guān)帖子
各位大哥,誰(shuí)知道電話機(jī)上錄音的芯片,15秒就夠了,在線等!
這個(gè)小程序竟然有錯(cuò)。。
大家進(jìn)來(lái)討論一下
關(guān)于清STATUS寄存器的問(wèn)題
專家點(diǎn)評(píng):哪里出問(wèn)題了?
免費(fèi)注冊(cè)為維庫(kù)電子開發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號(hào)