Re: INT interrupt problem
|
||||
---|---|---|---|---|
管理員
|
Dear Customer,
Your program should works well if you are using PIC16F877A or other equivalent devices. The button connected to RB0 on PICDEM2 Plus is S3. So, you will get INT0 interrupt if you press S3. You can set breakpoint at statement >> INTF=0 if you are debug your code by using MPLAB ICD2 or MPLAB ICE2000. I copied your code and executed it , my program will stopped at INTF=0 if I pressed S3. Of course , breakpoint must be set. Finally , you don't have to call InitINT( ) in your while(1) { .. } loop. you can move it to the next line of InitIO( ) . Let us know if you still gain any problem during your code development. Thanks & Best Regards,
發表於: 2005/8/3 21:51
|
|||
|
INT interrupt problem
|
||||
---|---|---|---|---|
新會員
|
I met a problem:
I use PICDEM 2 PLUS and write a INT interrupt test routin as follows. But I cannot go into the interrupt routine. Please give me a hand. Thanks a lot. # include <pic.h> void InitIO (void); void InitInt (void); void interrupt Isr (void); void main (void) { InitIO (); while (1) { InitInt (); if (RA4==0) PORTB=0b00000010; else PORTB=0b00000100; } } void InitIO (void) { PORTA=0x00; ADCON1=0b00001110; TRISA=0x11; PORTB=0x00; TRISB=0b11110001; } void InitInt (void) { INTEDG=0; INTE=1; GIE=1; } void interrupt Isr (void) { INTF=0; PORTB=0b00001000; }
發表於: 2005/8/3 18:09
|
|||
|