• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






Re: 中斷時間怎麼算呢?
#6
資深會員
資深會員


查看用戶資訊
1.請問主振盪器接Crystal,那Fosc就是Crystal的頻率嗎?
那麼計時器使用內部指令週期計數的話,是不是就要Fosc/4呢?


是的 !

除非你有使用 PLL 倍頻
不然 Fosc 就是 Crystal 的頻率

發表於: 2007/5/1 2:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 中斷時間怎麼算呢?
#5
中級會員
中級會員


查看用戶資訊
1.請問主振盪器接Crystal,那Fosc就是Crystal的頻率嗎?
那麼計時器使用內部指令週期計數的話,是不是就要Fosc/4呢?


謝謝版大!

發表於: 2007/4/30 17:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 中斷時間怎麼算呢?
#4
版主
版主


查看用戶資訊
1. 若Timer0使用外部Clock輸入,TOCKI 是直接進入到 Timer0 不需再除四。

2. 不是,那是主振盪器要接Crystal用的。

發表於: 2007/4/30 10:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 中斷時間怎麼算呢?
#3
中級會員
中級會員


查看用戶資訊
想請教一下
就是
1.如果把T0CS設為1(使用TOCKI腳位脈波變化)
使用Externl Clock Input的話
那在計算指令週期時的Fosc還要除以4嗎?
還是就以送進去多少的Fosc直接計算呢?

2.請問外部的時脈,是從OSC1/CLCKI/RA7及OSC2/CLCKO/RA6這2隻腳位送進去的嗎?

發表於: 2007/4/28 18:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 中斷時間怎麼算呢?
#2
版主
版主


查看用戶資訊
看 Timer0 的方塊圖,PSA=1 使用 1:1 的輸入,所以送到 Timer0 的頻率為 Fosc/4= Fcy (指令週期)。

(48MHz/4) / 65536 = 183.1Hz = 5.46mS 中斷一次

發表於: 2007/4/27 11:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


中斷時間怎麼算呢?
#1
中級會員
中級會員


查看用戶資訊
使用PIC18F4550操作頻率為48MHZ
1.請問像我這樣設成0x0000數到0xFFFF
中斷時間應該怎麼算呢?

2.請問TMR0H=0x00;
TMR0L=0x00;
是不是相當於WriteTimer0(0x0000)呢?
---------------------------------------------------------------------
#include <p18f4550.h>
#include <delays.h>
#include <timers.h>

#pragma config FOSC=HS, BOR = OFF, BORV = 2,PWRT = ON, WDT = OFF, LVP = OFF

void Init_TMR0(void);
void timer0_isr(void);

#pragma code low_vector=0x18
void low_interrupt (void)
{
_asm GOTO timer0_isr _endasm
}
#pragma code

#pragma interruptlow timer0_isr

void timer0_isr (void)
{
INTCONbits.TMR0IF = 0;
TMR0H=0x00;
TMR0L=0x00;
PORTD=PORTD^0xFF;

}

void main(void){
PORTD=0x0F;
TRISD=0;
Init_TMR0();
INTCONbits.PEIE = 1;
INTCONbits.GIE = 1;
while(1)
Nop();

}

void Init_TMR0(void){

INTCONbits.TMR0IE=1;
T0CON=0b10001000;
//設定為16bits計時器/計數器
//使用指令週期脈波變化
//不使用除頻器
TMR0H=0x00;
TMR0L=0x00;
INTCONbits.TMR0IF=0;
}
----------------------------------------------------------------------

發表於: 2007/4/26 16:30
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... ]

教育訓練中心

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