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

論壇索引


Board index » All Posts (superst)




關於石英震盪器的準確性
#1
新會員
新會員


就我的認知,如果我們的應用是要做類似電子錶或鐘的應用

我們的time base如果使用如timer2有auto-reload功能的timer不是應該可以很準嗎?
但我目前測試的結果,累積四個小時之後誤差大概可以達到15秒之譜,那麼對於這樣的應用根本是不可接受的

當然程式的結構的不良也許有可能造成這樣的原因,但我想問的是,如果不管程式的問題,也就是說有沒有人做過類似的應用,在沒有特別在軟體或硬體上做微調,而可以達到很準確的呢?

還是說做這樣的應用真的是要在震盪電路,或是在程式裡面做校正才能達到很準確,而不是只要用我們想像的"理論做法"就能達到的.

希望瞭解的人可以分享一下

發表於: 2009/3/21 21:48
頂部


Re: 關於16FXX的外部中斷INT問題
#2
新會員
新會員


Ryang兄
依照datasheet的資料,OPTION開機後的預設值應該全部為1,而當INTEDG是1的時候應該是rising edge不是嗎?

而且重點是現在不管INTEGD是0或1,都是在rising edge產生中斷
詭異的是有一個例外,我將ISR改寫為:
isr(void) // Here be interrupt function - the name is unimportant.
{

if(INTF){
INTF = 0;
RA3 = !RA3;

OPTION ^= 0x40;

}

}

也就是在INT中斷產生時,把INTEDG反相,那麼在falling edge就會產生中斷,用來debug用的IO port輸出波形就會變成跟信號產生器的波形變成一樣(也就是rising和falling都會中斷)
除此之外我就是沒辦法單獨讓他falling edge產生中斷

發表於: 2009/3/12 11:05
頂部


關於16FXX的外部中斷INT問題
#3
新會員
新會員


我現在是用16F73且使用PICC compiler
要用INT功能,且需要falling edge中斷
不過奇怪的是不管我INTEDG這個bit怎麼設定,或是直接設定OPTION,都是在上升緣產生中斷
我的試驗方法是用信號產生器給INT一個clock,在ISR中將另一隻IO腳反相,然後用示波器同時觀察兩個信號,結果發現那隻IO腳只有在當信號產生器的clock上升緣變化
不知道有沒有人欲過這種情形!
程式如下:

#include <htc.h>
#include <stdio.h>

void init(void);

void main(void)
{
init();

RA3 = 0;
while(1);
}

void init(void)
{



OPTION = 0x03;
INTCON = 0x00;

PIR1 = 0x00;
PIE1 = 0x00;


/*setting I/O port direction 0:output 1:input*/
TRISB = 0x01;
TRISA = 0x00;
TRISC = 0xbf;
PORTA = 0xff;


PORTC = 0xff;
PORTB = 0x01;

ADCON1 = 0x07;


/*setting INT*/

INTE = 1;
INTF = 0;




/*enable all interrupt*/
PEIE = 1;
GIE = 1;

}

static void interrupt
isr(void) // Here be interrupt function - the name is unimportant.
{

if(INTF){
INTF = 0;
RA3 = !RA3;


}


}

發表於: 2009/3/11 16:17
頂部






:::

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... ]

教育訓練中心

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