Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] microC external interrupt (INT0/RB0) does not work.

Status
Not open for further replies.

dim912

Junior Member level 2
Joined
Sep 9, 2009
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Colombo
Activity points
1,524
I am using "PIC MINI WEB" header board and it include PIC18F25J10. I wrote a very simple program and check the external interrupt. But unfortunately it is not working. Please tel me the fault I have done in programming.

IMPORTANT - (1) RB0 is pulled up.(grounded when the button is pressed)
(2) LED lights when RC2 pin goes to zero.


here is the code.



void interrupt(){

PORTC=0x00; //LED(connects to RC2)
Delay_ms(1000);
PORTC=0xFF; //LED off

INTCON.INT0IF=0;
INTCON.INT0IE=1;

}


void main() {
TRISB=0xFF;
TRISC=0x00;

//to check whether LED works.
PORTC=0x00 ;
Delay_ms(1000);
PORTC=0xFF ;
//above three lines work properly(LED lights for one second)

INTCON.GIE=1;
INTCON.INT0IE=1;
INTCON2.INTEDG0=0;//falling edge

while(1){}
}
 

I think portB also the function for AD converter. By default portB is AD inputs.
You should need to set portB as Digital function mode first then define as input.
Check ADCON register.
Hope helps
 
  • Like
Reactions: dim912

    dim912

    Points: 2
    Helpful Answer Positive Rating
Thank you very much emresel. I set the ADCON1 register and now it works properly.. Thank you very much again.
Wish u for happy future.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top