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


Browsing this Thread:   1 Anonymous Users






Re: 使用PIC18F2410,外部中斷INT0問題
#4
資深會員
資深會員


查看用戶資訊
不好意思,我看錯了,我以為你用timer0輸入pluse.原來你是用INT0輸pluse,我的意思是要你翻翻data sheet注意這些中斷的設定是不是都有打開了.
建議你在對中斷不熟時別寫的太複雜了,可以用一個按鍵來做中斷源,中斷時弄個LED,按一下按鍵LED ON,再按一下LED OFF,等熟了之後再改成你要的.

發表於: 2007/8/25 0:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 使用PIC18F2410,外部中斷INT0問題
#3
中級會員
中級會員


查看用戶資訊
GIE有設定=1
PEIE沒設定=0
TMR0IE沒設定(目前沒用)
TMR0IP沒設定(目前沒用)
RCON:IPEN程式中已有設定

目前TMR0沒有使用,only使用int0


發表於: 2007/8/24 15:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 使用PIC18F2410,外部中斷INT0問題
#2
資深會員
資深會員


查看用戶資訊
INTCON:
GIE/GIEH: Global Interrupt Enable bit
PEIE/GIEL: Peripheral Interrupt Enable bit
TMR0IE: TMR0 Overflow Interrupt Enable bit

INTCON2:
TMR0IP: TMR0 Overflow Interrupt Priority bit

RCON:
IPEN: Interrupt Priority Enable bit

T0CON:
T0PS2:T0PS0: Timer0 Prescaler Select bits

以上都有設定了嗎??

發表於: 2007/8/24 15:28
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


使用PIC18F2410,外部中斷INT0問題
#1
中級會員
中級會員


查看用戶資訊
目前使用PIC18F2410,有用到外部中斷INT0,希望INT0中斷時,中斷服務程式會去執行中斷,目前INT0腳位輸入一個50HZ的輸入訊號,但中斷服務程式卻的不到相對輸出,中斷會遺失(不發生),我的程式如下,是否有設定的問題,希望個位大大幫幫忙提供意見, 謝謝
void initpic(void)
{
OSCCONbits.IRCF0=0; // 110=4Mhz INTOSC drives clock directly
OSCCONbits.IRCF1=1; // MCU Default:100=1Mhz
OSCCONbits.IRCF2=1;
ADCON1=0b00001111; // Disable A/D Function
CMCON =0b00000111 ; // Disable Comparator module !!
TRISA=0xFF; // Set PortA for input
PORTA=0xFF; // Switch input
TRISB=0b10000011; // Set PortB
LATB =0;
PORTB=0b11110011; //
TRISC=0x00; // Set Portc for Output
PORTC=0xff; // Initila LED display = 0xFF (LED全滅)
OpenRB0INT ( PORTB_CHANGE_INT_ON & FALLING_EDGE_INT & PORTB_PULLUPS_ON );
}

void F_Enable_High_Interrupts (void)
{
RCONbits.IPEN = 1;
INTCONbits.GIEH = 1;
}

#pragma code isrhighcode = 0x0000008
void isr_high_direct(void)
{
//***EXERCISE 2 CODE HERE***
_asm //begin in-line assembly
goto isr_high //go to isr_high function
_endasm //end in-line assembly
}
#pragma code

void isr_high(void)
{
Freeled=0;
if ( INTCONbits.INT0IF == 1 ) // 外部中斷'0'
{
INTCONbits.INT0IF=0;
ISRled= 0;
Nop( ) ;
ISRled= 1;

}
Freeled=1;
}

void main(void)
{
initpic();
while ( 1 )
{
Care_Test(); // self test
}
}


發表於: 2007/8/24 11:52
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... ]

教育訓練中心

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