Custom Interrupts

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
Kumaran
Posts: 73
Joined: Tue Apr 08, 2008 5:23 pm
Been thanked: 1 time
Contact:

Custom Interrupts

Post by Kumaran »

Hi

How to use Port A, pin 0 of 16F684 as interrupt pin? In this regard, when I search your forum. I found two topics related exactly to my issue. http://www.matrixmultimedia.com/mmforum ... rupt#p3241
http://www.matrixmultimedia.com/mmforum ... upt#p12425

But the solution provided in those topics did not not help me. Because for one topic updated file has been provided for different IC and other solution I could not understand. I need more information to apply. Please see attached the program.

Can you please help me?

Thanks in advance.

Kumaran
Attachments
Flowcode_Interrupt.fcf
(6.5 KiB) Downloaded 325 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Custom Interrupts

Post by Benj »

Hello Kumaran

From looking at the device datasheet there are two pin interrupts available to you. Interrupt names are for legacy reasons and again have been updated for V4.

1) Pin RA2 only - the RB0/INT interrupt.

2) Pin RA0, RA1, RA3, RA4, RA5 - the RB Port Change interrupt.

The port change interrupt will fire each time any of the pins listed above change state. If you need the port change interrupt to detect pin RA0 only then you can read the pin at the very beginning of the interrupt macro to determine if it was indeed RA0 that caused the interrupt and not the other pins.

Eg

Interrupt Macro

Input Icon - Single pin read - RA0 into variable pinA0

Decision Icon - pinA0 = oldpinA0

Yes - Do nothing the pin hasn't changed state
No - Perform your interrupt task and then assign the variable pinA0 to the variable oldpinA0 using a calculation icon so that it is ready for the next interrupt.

Post Reply