Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

interrupt please please please help!

Status
Not open for further replies.

tuanvoi

New Member
hi all,

I want to set up an external interrupt on PORTB pin0 (when PORTB pin0 is high) of my PIC18F4550 and an internal interrupt on USART of Rx.

In my external interrupt:

-I will use USART to transmit some bytes to the receiver, and expect to receive some data sent back from the receiver.

Is there any way that I can jump to the internal interrupt USART Rx while the external interrupt of PORTB pin0 is still high even it is done with it interrupt subroutine?

I've tried to clear the external interrupt flag bit (when I'm done with the subroutine while PORTB pin0 is still high), but still it continues to loop back the subroutine (not return to routine).

Could you please help me? Thank you.
 
PORTB.0 AKA INT0 is edge-triggered. Pin state doesn't matter; if pin made low to high transition causing interrupt and you cleared the interrupt flag while the pin was high it shouldn't interrupt again until pin goes low and then high again. If you are getting interrupts on level pin it most likely means your input is noisy. Have you configured it as digital - by default it's analog on power on?
 
PORTB.0 AKA INT0 is edge-triggered. Pin state doesn't matter; if pin made low to high transition causing interrupt and you cleared the interrupt flag while the pin was high it shouldn't interrupt again until pin goes low and then high again. If you are getting interrupts on level pin it most likely means your input is noisy. Have you configured it as digital - by default it's analog on power on?

Thanks
I've configured the pins as digital.
So when I'm done with my interrupt subroutine, I clear the interrupt flag. It should return to previous routine that the PIC was running even the PORTB pin0 is still high (this is where the interrupt triggered) ???
Thanks for you comments "felis".
Tom
 
So when I'm done with my interrupt subroutine, I clear the interrupt flag. It should return to previous routine that the PIC was running even the PORTB pin0 is still high (this is where the interrupt triggered) ???

If you have only one interrupt source and your pin hasn't changed since the time you cleared the flag, yes. This pin can be set to generate interrupt on either rising or falling edge so if you set it for the rising edge, say, then you get first interrupt when pin goes high and the second when pin goes low and then high again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top