• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 拜託!幫幫忙,請幫我看看程式哪裡有問題...
#3
新會員
新會員


查看用戶資訊
感謝您回覆指教,修正後七段顯示器目前可以跳到5.....
然後又停在延遲副程式d3 nop了... 實在是不解!?
以MPLAB IDE全速模擬雖然是停在nop處,但是用step方式程式仍然可以繼續跑完(0-9),不解..實在是不解....
可以在請您幫忙看一下嗎?
p.s 程式中decfsz f,d : d目前均已修正為1

發表於: 2006/7/29 18:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 拜託!幫幫忙,請幫我看看程式哪裡有問題...
#2
高級會員
高級會員


查看用戶資訊
你的遞減回圈,遞減值沒有回存
看看這3個DECFSZ有啥不同
最後一個才正確

delay                      ;delay program
d1 movlw D
'100'            
     
movwf 0dh               
d2 movlw D
'200'
     
movwf 0eh               
d3 nop       
<------------------------------------沒有設斷點,卻停在這裡             
    nop        
    decfsz 0eh              
    
goto d3                 
    decfsz 0dh              
    
goto d2
    decfsz Delay_cnt
,1
    
goto d1
    
return

發表於: 2006/7/29 16:29
微電腦自動控制設計,產品製造
才疏學淺,若有錯誤敬請指正
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


拜託!幫幫忙,請幫我看看程式哪裡有問題...
#1
新會員
新會員


查看用戶資訊
小弟最近在學習PIC16FXX,參考的書籍是"PIC16F84單晶片微電腦入門實務"全華出版的,照著書本程式一步步學習覺得還滿好玩的!唯一的缺點是書本範例都是需要SPASM組譯的,但是我只有MPASM組譯器,所以就參考範例順便將程式改成MAPSM可編譯的MICROCHIP指令!
今天把一個七段顯示器範例修改成MPASM可編譯的之後,在MAPLAB IDE模擬看起來都正常,但是把程式燒進IC之後卻只有顯示0~2然後又跳回0了.....
後來再用模擬器測試後發現程式會停在沒有設斷點之處,那個地方是延遲副程式NOP之處,小弟是初學,實在是找不出來,可以幫我看看是哪裡出問題嗎?拜託!!謝謝!
List p=pic16f84a
Delay_cnt     equ 0Ah        
;define Delay factor
Display_cnt   equ 1Ah        
;define Display reserch
zero_ref      equ 1Ch        
;define zero reference
PCL           equ 02h        
;define Program Counter
              org 00h
              
goto start
start
      bsf   H
'03',5        ;change to page1
      movlw 
B'00000000'    ;Port B is output port
      movwf H
'06'          ;
      
bcf   H'03',5        ;back to page0
      bcf   H
'03',0        ;clear carry flage
      clrf  H
'06'          ;clear port B
      movlw  D
'10'         ;put 10 into w
      movwf zero_ref       
;move w to zero_ref
      movlw D
'00'          ;put 00 into w
      movwf Display_cnt    
;move w to Display_cnt
;----------------------------------------------------------------
LOOP
      call  AccDispcode    
;call data table
      movwf H
'06'          ;get the data and output form PortB
      movlw  D
'10'         ;put 25 into w
      movwf Delay_cnt      
;move w to Delay_cnt
      call  delay          
;call delay program
      incf  Display_cnt
,1  ;inc Display_cnt and save itself
      movf Display_cnt
,0   ;move Display_cnt into w 
      decfsz zero_ref
,1    ;dec zero_ref and save itself
      
goto LOOP            ;if zero_ref isn't 0
      goto start           ;if zero_ref is 0
;------------------------------------------------------------
AccDispcode                ;data table
      addwf PCL,1          ;PCL+W is PC offset to...
      retlw H'
C0'          ;when w=0
      retlw H'
F9'          ;when w=1
      retlw H'
A4'          ;when w=2
      retlw H'
B0'          ;when w=3<------斷點設在這裡,再按執行後停在延遲副程式NOP之處
      retlw H'
99'          ;when w=4
      retlw H'
92'          ;when w=5
      retlw H'
83'          ;when w=6
      retlw H'
F8'          ;when w=7
      retlw H'
80'          ;when w=8
      retlw H'
90'          ;when w=9
;-------------------------------------------------
delay                      ;delay program
d1 movlw D'
100'            
     movwf 0dh               
d2 movlw D'
200'
     movwf 0eh               
d3 nop       <------------------------------------沒有設斷點,卻停在這裡             
    nop        
    decfsz 0eh              
    goto d3                 
    decfsz 0dh              
    goto d2
    decfsz Delay_cnt,1
    goto d1
    return
    end

發表於: 2006/7/29 1:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------