• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
:::


Browsing this Thread:   1 Anonymous Users






Re: 問各Delay的問題
#4
資深會員
資深會員


查看用戶資訊
Delay 1K Tcy x (n);

就是意含 Delay (1000 個Tcy指令週期 × n) 這麼長的時間。

Cycles = (TimeDelay * Fosc) / 4

24MHz 頻率下,要 1mS 時:

Cycles = (1ms × 24MHz) / 4
= 0.001 S × 24,000,000 Hz / 4
= 6000

Delay 6000 Cycles 就要 Delay1KTCYx(6);

31.25kHz 頻率下,要 1mS 時:

Cycles = (1ms × 31.25kHz) / 4
= 0.001 s × 31,250 Hz / 4
= 7.8

7.8=1000*0.0078
0.0078 個 千週期
8 個週期

應該要改用 Delay1TCY(8),比使用 Delay1KTCY(0) 好

發表於: 2008/2/26 17:56
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 問各Delay的問題
#3
中級會員
中級會員


查看用戶資訊
不好意思, 借開板大大的主題問一下, Delay1KTCYx()的時間延遲公式是如何?

如果有疑義, 小弟另行開板詢問, 謝謝.

發表於: 2008/2/26 16:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 問各Delay的問題
#2
資深會員
資深會員


查看用戶資訊
1 ms * 31.25K /4 = 7.8125

Delay1TCY(8); // Delay of 1ms

發表於: 2008/2/26 12:21
不要問我哪裡來,我只是個流浪天涯的工程師
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


問各Delay的問題
#1
中級會員
中級會員


查看用戶資訊
void Delay_1ms(byte delaytime)
{
int i;
for(i = 0; i < delaytime; i++)
{
Delay1KTCYx(6); // Delay of 1ms
// Cycles = (TimeDelay * Fosc) / 4
// Cycles = (1ms * 24MHz) / 4
// Cycles = 6000
}
}

上面是一段Delay的code....
從書上抄來的..這是用實驗版所使用的code..
用的是外部震盪器24MHz的

想請問一下我現在另外使用了一個PIC
如果使用內部震盪器...31.25k
這段code我要如何設?

因為直接使用這段code也是可以跑....
不過會變很慢....~_~

發表於: 2008/2/26 12:03
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... ]

教育訓練中心

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