Page 1 of 1
MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 8:27 am
by PUTS_JO
HELLO INTERRUPT SPECIALISTS.
DOES ANYONE KNOW HOW TO USE MORE THEN 3 INTERRUPTS ON THE 18F4455? I SAW IN THE HELP FILE IT IS POSSIBLE TO USE RB0,RB1, AND
RB2 AS INTERRUPTS. BUT THERE IS ALSO A PORT FUNCTION . IS IT POSSIBLE TO CONFIGURE FOR EXAMPLE RB4 AS AN INTERRUPT PIN, AND HOW CAN I DO THIS THAN?
CAN SOMEBODY HELP ME BY USING MORE THEN 3 INTERRUPTS?
THANKS
PUTS_JO
Re: MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 8:34 am
by Benj
Hello,
If you look at section 9.9 of the device datasheet then this details the PortB Interrupt on change. This enables an interrupt that will fire if any of the inputs on the upper half of PortB change. Once the interrupt has fired you can read the port and compare with a variable containing the last read to work out which pin has changed. Therefore RB3 is the only pin of PortB that cannot be made into an interrupt.
Re: MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 9:01 am
by PUTS_JO
BEST BENJ
How can i read my port B4 after an interrupt has passed on it ? do i have to write a little c program? can you put me on the road for programming it and exclude only port B4?
Thanks.
PUTS_JO
Re: MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 9:46 am
by Benj
Hello,
At the start of the interrup macro you would read the port compare with a variable. This would start at 0 when your program starts. Once you have compared with the variable and found out which bit is different you can save the port value into the variable for use next time around the loop.
I know there are good Flowcode examples available already on the forum. I would have made you a small Flowcode example but you are not posting in the Flowcode area of the forums so I assume you are using C or assembly.
Re: MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 12:02 pm
by PUTS_JO
BEST BENJ,
Thanks for your reply
MY PROGRAM NEEDS TO LEVEL BETWEEN 2 SETPOINTS
I am using flowcode 4 ;my program is just for changing a value that is on a display without a keyboard panel;i have 4 buttons a setup ;a plus;a minus and a store button . but i have only 3 interrupt buttons to immediately change ;so i send you my program in flowcode4 in attachment.
Maybe there is a better solution to change parameters on a 4line display?
kind regards
PUTS_JO
Re: MORE INTERRUPTS THAN 3 PINS ?
Posted: Fri Sep 24, 2010 12:46 pm
by Benj
Hello,
Sorry but I cant answer Flowcode 4 questions outside of the v4 forum topic.