Browsing this Thread:
2 Anonymous Users
|
Re: 關於18F4620和18F452的INT0
|
|
高級會員
Joined
: 2005/5/7 9:20 最後登入時間
: 7/16 9:52
From Taiwan
Group:
註冊會員
Level : 9 HP : 0 / 215 MP : 37 / 12193 EXP : 60
|
PORTB的指令改成LATB試試…
發表於: 2007/11/8 9:34
|
|
|
關於18F4620和18F452的INT0
|
|
新會員
Joined
: 2007/11/5 18:59 最後登入時間
: 2009/4/28 14:05
Group:
註冊會員
Level : 1 HP : 0 / 2 MP : 1 / 134 EXP : 10
|
#include<p18cxxx.h> #include<stdlib.h> #include<delays.h>
void InterruptHandlerHigh(void); void main() {
RCONbits.IPEN = 1; INTCONbits.INT0IE = 1; INTCONbits.GIEH = 1;
TRISB = 0x01; PORTB = 0x00; while(1); }
//------High priority interrupt vector--------------------- #pragma code InterruptVectorHigh = 0x08 void InterruptVectorHigh(void) { _asm goto InterruptHandlerHigh _endasm } #pragma code
//------High priority interrupt routine-------------------- #pragma interrupt InterruptHandlerHigh void InterruptHandlerHigh() { if(INTCONbits.INT0IF) { INTCONbits.INT0IF = 0; PORTBbits.RB7 = 1; Delay10KTCYx(500); PORTBbits.RB7 = 0; } }
==================================== 上面是自己寫個4620的INT0外部觸發,使RB7的LED燈亮, 看過datasheet多次但還是找不出哪裡有沒設定到的,以上的程式燒錄到452卻可以正常運作,不知道4620哪裏還沒設定到,請各位有經驗的大哥指教小弟一下,謝謝!
發表於: 2007/11/5 19:06
|
|
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.