• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問如何停止??...關於RS232
#4
版主
版主


查看用戶資訊
你的程式為:
decfsz k,f
goto Trans
goto $
END

如果沒有用 goto $ 攔住程式的話(因decfsz k,f 的k=0)就會亂跑了,如果後面都是0x3FF 的程式碼就會 rollover 到 0x000的位址。

發表於: 2006/8/15 13:58
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問如何停止??...關於RS232
#3
初級會員
初級會員


查看用戶資訊
嗯嗯...
感覺的確是從0x0000重新執行
那想請問依下....是什麼原因會造成 over roll?
不好意思....書上好像都沒提過這問題
所以不太懂...
可以解釋ㄧ下嗎....
先謝謝了.....
-----

發表於: 2006/8/15 11:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問如何停止??...關於RS232
#2
版主
版主


查看用戶資訊
沒有 goto $ 是因為程式失去控制後 over roll 回到0x0000的位址重新執行,加了goto $ 後你的程式應該只會執行一次然後就停在 goto $ 的迴圈裡。這是程式的邏輯如此,所以只有改變程式的流程才能改變目前得問題。

發表於: 2006/8/11 16:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問如何停止??...關於RS232
#1
初級會員
初級會員


查看用戶資訊
我所使用的是pic16f877
我在測試RS232與電腦傳輸
我想要的動作是由單晶片傳輸9876543210
傳完10個bytes則停止

********************************

list p=16F877
#include<p16f877.inc>
trans_c equ 0x20
k equ 0x21
org 0x00

initial:
movlw .58
movwf trans_c
movlw .10
movwf k
banksel SPBRG
movlw .25
movwf SPBRG
bcf TXSTA,SYNC
bsf TXSTA,BRGH
banksel RCSTA
bsf RCSTA,SPEN
banksel TXSTA
bsf TXSTA,TXEN
bsf TXSTA,BRGH



Trans:
banksel TXSTA
btfss TXSTA,TRMT
goto Trans
banksel TXREG
decfsz trans_c,f
movf trans_c,w
movwf TXREG
decfsz k,f
goto Trans
goto $
END
********************************
我若不加goto $
則會ㄧ直輸出987654321098765432109876543210.......
但是一加上goto $
連跑都不會跑???
該如何只跑一次??....
單晶片程式跑到end還是不會停??
不好意思...新手還很多不清楚.....
PS:我watchdog 有off掉.........


發表於: 2006/8/8 14:38
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... ]

教育訓練中心

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