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.

[PIC] external Interrupt pic 16F676 mikro c

Status
Not open for further replies.

David_1

Newbie level 2
Joined
Apr 21, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
how to use external Interrupt(button) in pic 16F676 mikro c?
 

Hi,

There is the PIC datasheet (often with example cide)
There will be a micro c tutorial
There are countless tutorials how to use interrupts
There are many discussions in the internet and here in this forum..

I assume you did a research on your own...and it seems you didn't find what you are looking for.

So please tell us more precisely what information you are missing.

Klaus
 

i am not find any example in data sheet for external int in 16f676.
 

Do you think there should be examples for everything?
Isn't it enough documented?

a) Initialize once (set interrupt bit to enable it, select edge transition, global enable interrupts)
b) in the interrupt routine, check if the external int flag bit is set and if yes, act as you please and clear this flag at end.
 

Also be careful of using an interrupt on a button input. Buttons (and switches and any other similar mechanical device) can have contact bounce that can last for several mSec. On the other hand the ISR will probably react in uSec time frames to the first transition it sees, set it s flag, have the main loop process it and then see the next 'bounce' transition which calls the ISR again etc..
Always debounce a button or switch input. You can do this externally with electronic components (basically a low pass filter using a resistor and capacitor arrangement) or programmatically (I prefer to sample the input line in an ISR that is called by a timer every 1mSec and when it sees the same value on the button input for more than (say) 5 calls (or 5mSec) then it sets the flag for the main loop - this can be extended to sample multiple input sources).
I suggest that you read up on debouncing techniques that are suitable for your overall requirements.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top