• 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)


Re: 計時器中斷與LED
#7
資深會員
資深會員


查看用戶資訊
不會亮嗎??

先用SIM 或ICD2 試看看
timer1 會不會進中斷程式

另外,
#include <p30fxxxx.h> << 這行刪掉吧, 前面已經有include了, 這個是多此一舉

發表於: 2009/10/20 22:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 計時器中斷與LED
#6
高級會員
高級會員


查看用戶資訊
在想說是不是要修改PR值

才能讓它顯示??

不好意思才剛學 問題也比較多點
請大大指教

發表於: 2009/10/20 20:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 計時器中斷與LED
#5
高級會員
高級會員


查看用戶資訊
已經依大大的意思下去改看看了

可是它變成不會亮
這是因為??

發表於: 2009/10/20 20:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 計時器中斷與LED
#4
資深會員
資深會員


查看用戶資訊
雖然進中斷時有執行 LATEbits.LATE0=0;
可是中斷結束,回主程式時又立刻執行 LATEbits.LATE0=1;
結果就是,LED 只有進中斷時的瞬間暗一下,然後又亮了
時間那麼短,肉眼根本看不出來的


你程式可修改如下

while(1)
{
// LATEbits.LATE0=1; <==這行刪掉
}




void __ISR__T1Interrupt(void)
{
LATEbits.LATE0=!LATEbits.LATE0; //在這裡做反向即可
IFS0bits.T1IF=0;
}

發表於: 2009/10/20 20:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 計時器中斷與LED
#3
高級會員
高級會員


查看用戶資訊
可是我把周期調大
就是把0x2000
可是還看不到閃爍
小弟能力有限
請各位大大賜教

感嗯

發表於: 2009/10/20 19:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 計時器中斷與LED
#2
資深會員
資深會員


查看用戶資訊
我想應該是你肉眼看不到LED的 "閃爍"
而不是Timer沒中斷

發表於: 2009/10/20 19:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


計時器中斷與LED
#1
高級會員
高級會員


查看用戶資訊
各位板大您們好
小弟有寫個程式是以計時緝中斷讓LED閃爍
可是計時器好像沒反應 可幫忙指導一下問題出現在哪邊嗎
想了很久實在找不出問題 想麻煩各位板大
附上我寫的程式
#include <p30F4011.h>
#include <timer.h>
#include <p30fxxxx.h>
#define FCY 7372800*2
_FOSC(CSW_FSCM_OFF & XT_PLL8);
_FWDT(WDT_OFF);
_FBORPOR(PBOR_OFF & MCLR_EN);
_FGS(CODE_PROT_OFF);
int main(void)
{
ADPCFG=0xffff;
TRISE=0xfff0;
ConfigIntTimer1( T1_INT_PRIOR_7& T1_INT_ON) ;
OpenTimer1(T1_ON & T1_GATE_OFF &
T1_PS_1_8 & T1_SYNC_EXT_OFF &
T1_SOURCE_INT,0x2000 );
while(1)
{
LATEbits.LATE0=1;
}
}

void __ISR__T1Interrupt(void)
{
LATEbits.LATE0=0;
IFS0bits.T1IF=0;
}

發表於: 2009/10/20 18:55
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... ]

教育訓練中心

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