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


Browsing this Thread:   1 Anonymous Users




« 1 2 (3)


Re: 關於Timer0...
#4
資深會員
資深會員


查看用戶資訊
這是一種程式架構,你可以參考看看,一些I/O debounce之類的可以放在t5ms那部分來做.
timer0 prescale 1:4
timer:
clrwdt
movlw .23
subwf tmr0,w
btfsc status,c
goto timer
clrf tmr0
clrf fsr ;bank0
....
....
....
decfsz t100us,f
goto mq1
movlw .50
movwf t5ms
;t5ms
...
...
...

decfsz t5ms,f
goto mq1
movlw .50
movwf t5ms
incf t250ms,f
;t250ms
...
...
...
mq1:
clrf fsr ;bank0
retlw .0
;---------------------------------------------------
main:
call timer
...
...
....
btfsc t250ms,0 ;led on 250ms/off 250ms
bsf rc,led ;
btfss t250ms,0 ;
bcf rc,led ;
goto main


發表於: 2007/7/4 8:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於Timer0...
#3
資深會員
資深會員


查看用戶資訊
3Q, 阿里阿多 .. 了解 ,, 但是還是有問題???
一般的delay程式的缺點, 也就是我現在碰到的問題..
一旦跑delay時無法做其它的事情了;
所以就想動Timer0的主意 .
不了解的是, 在使用10F200,12F508時 ..
當我Call, 這個Timer0, 1ms delay程式後;
主程式如何去知道Timer0 ,1ms delay程式完成了沒?
還有主程式Call 這個1ms delay程式後,
是否就可以去做.. 自己愛做的事了.. 哈.哈.


發表於: 2007/7/4 1:00
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於Timer0...
#2
資深會員
資深會員


查看用戶資訊
一般的delay程式是有缺點的:就是delay時無法做其它的事情了
另外就是使用timer的時間準確度比較高,像以下的程式最小準確度是4us.
ex: 4MHZ
delay_1ms:
movlw .250
movwf lop1
loop:
clrwdt ;1 us
decfsz lop1,f ;1 us
goto loop ;2 us
retlw .0
timer的另一個用法是接收波形時,用來計算波形的寛度.
ex:接收一個波形
+----------------+
| |
-------+ +-------------
可以在正緣时把timer歸零,在負緣時就知道波形寬度了..


發表於: 2007/7/1 21:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於Timer0...
#1
資深會員
資深會員


查看用戶資訊
各位Dear大大:
笨鴨偶咩,玩 10F20X, 12F50X 已經一陣子了...
說來好笑... Timer0 ,,還沒有用過, 也不知要如何用它;
知道可以用來 當 Delay 程式 ,
但是 偶也可以寫一個 Delay 程式, 那 Timer0 要幹啥呢?
所以在此請教各位大鍋大姐, 是否可以教教笨鴨偶囉.3Q Lar.
Have a nice weekend.....

發表於: 2007/6/30 6:34
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... ]

教育訓練中心

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