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.

Interrupt from an RF module

Status
Not open for further replies.

Korawy

Member level 3
Member level 3
Joined
Sep 8, 2011
Messages
61
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
1,776
Hi all,,

Im controlling a robot through RF Module.
I test the RF and it works fine when i put the code in main program (using mikroc),Later i tried to make an interrupt from this RF, But interrupt not occur.
I initialized an Interrupt routine so that when portb.f0=1 the interrupt occurs, but that doesnt happen.

This is how i initializes the interrupt:

Code:
INTCON.F7=1;
INTCON.F6=0;
INTCON.F4=1;
RCON.F7=0;
INTCON2.F6=1;

I test the interrupt using switch in proteus and it works fine, but in real that doesnt happen.

I think that the period of "1" from the RF receiver (which is less than 1000us) doesnot activate the interrupt, Is that true??!
 

Without knowing the exact MCU or RF module you're using, here's two general possibilities:

1) Most RF modules output logic low when they signal an interrupt. Your statement that "when portb.f0=1 the interrupt occurs" suggests you may have set it up in reverse.

2) I think you're probably using a PIC16, which I'm not directly familiar with. On the PIC24 at least, external interrupts are edge-triggered rather than level-triggered; meaning they're triggered only by changes. When the interrupt pin goes low the first time, the interrupt will be triggered. But then, even after you clear the interrupt flag in your ISR, the interrupt will not be triggered again if the pin remains low. It must go high, then transition from high to low again (falling edge trigger), for another interrupt to occur. This tripped me up a few times when I wasn't properly clearing the source of the interrupt in an RF module. (And if you've set it up in reverse, as described in #1, you won't even get the first interrupt; since no low-to-high rising edge ever occurs.)

Interrupts will trigger in much less than a uSec, so I don't think that's an issue.
 
  • Like
Reactions: Korawy

    Korawy

    Points: 2
    Helpful Answer Positive Rating
Thank u Darkcobra for ur reply...

for no.1 my RF Module not reversing logic states, so that when comes "1" it outputs "1" and vice verca.

for no.2 Im using Pic18F, I check the datasheet and found that Interrupts are edge-triggered, so the period of "1" is not matter.

When the interrupt pin goes low the first time, the interrupt will be triggered. But then, even after you clear the interrupt flag in your ISR, the interrupt will not be triggered again if the pin remains low. It must go high, then transition from high to low again (falling edge trigger), for another interrupt to occur.

This may be the problem, as when i power on the pic, The LED is ON (What happened when an interrupt occurs) and then it's OFF, But the interrupt never occurs again.

- - - Updated - - -

I replace the RF with a switch and the interrupt works....another note is that the RF receiver when powered outputs random data which activate the Interrupt for a while and then does not happen again.
 

Are you polling the interrupt flag or have you implemented an Interrupt Service Routine (ISR).

If you are utilizing a UART in conjunction with the RF module you can certainly use the UART RX interrupt.

BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top