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.

rb0 interrupt received from wave generator is not detected

Status
Not open for further replies.

sush

Member level 4
Joined
Aug 24, 2005
Messages
78
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
1,946
rb0 interuupt pic

hi i have made for frequency mesurement .m using internal oscillator and external interrupt is on pin rb0 . he problem m getting is the controller isnt detecting external interrupt received from a square wave generator, any reasons suggested?
 

Re: rb0 interuupt pic

I think it should detect the interrupt.
However, I do not sse where you save/restore the STATUS register in the ISR. Maybe that causes problems later in the code and makes it look like it did not detect an interrupt.

Please see page 109 of the datasheet (Example 14-1) for the correct way to save restore the W and STATUS registers. Simply copy that code.
It is important to use the swapf instruction to save/ restore the STATUS register, because, unlike the movf or movwf, this instruction, swapf does not alter the flags.
 

rb0 interuupt pic

well, I see additional problems just looking at your ISR code. You can exit the ISR without restoring W. Why do you call delay in the interrupt handler? You certainly won't measure anything faster than 10 hz... Maybe you should spend a little time understanding interrupts and how to use them.

Does toggling the TMR1ON bit work the way you expect it to? I think I'd just read TMR1H/L and then clear them on every interrupt. Though that does require some care in how you use the value in your main loop.

Also, I'd spend more time thinking about comments. There should be A LOT more of them (like every line) - your initialization code is a perfect example.
 

rb0 interuupt pic

thanks for replying i deleted the delay and my controller is detecting the external interrupt
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top