MORE INTERRUPTS THAN 3 PINS ?

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
PUTS_JO
Posts: 20
Joined: Wed Sep 01, 2010 8:11 am
Has thanked: 1 time

MORE INTERRUPTS THAN 3 PINS ?

Post 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

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: MORE INTERRUPTS THAN 3 PINS ?

Post 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.

PUTS_JO
Posts: 20
Joined: Wed Sep 01, 2010 8:11 am
Has thanked: 1 time

Re: MORE INTERRUPTS THAN 3 PINS ?

Post 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

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: MORE INTERRUPTS THAN 3 PINS ?

Post 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.

PUTS_JO
Posts: 20
Joined: Wed Sep 01, 2010 8:11 am
Has thanked: 1 time

Re: MORE INTERRUPTS THAN 3 PINS ?

Post 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
Attachments
HAAGSCHAARLEVEL3.fcf
(21.48 KiB) Downloaded 321 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: MORE INTERRUPTS THAN 3 PINS ?

Post by Benj »

Hello,

Sorry but I cant answer Flowcode 4 questions outside of the v4 forum topic.

Post Reply