pic18f252 and rb2 interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
arnaud2
Posts: 9
Joined: Wed May 16, 2007 7:00 pm
Contact:

pic18f252 and rb2 interrupt

Post by arnaud2 »

hello
i want to use rb2 interrupt but in simulator mode when i push on rb2 contact this change nothing
is any solution?
thanks

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:

Post by Benj »

Hello

What PICmicro are you using and how are you setting up the interrupt.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

The simulation only "understands" the INT1, PORTB and TIMER0 interrupts - all other interrupts can be created and will work in hardware, but cannot currently be simulated.

submarine
Posts: 10
Joined: Wed Feb 14, 2007 10:06 am
Contact:

Post by submarine »

Hallo Steve,

can i make my interupt with FLOWCODE V3? i mean at a pin, but it is not
INT or TIMER0.

thanks

wei

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

I've recently fixed Flowcode so that it simulates INT0, INT1 and INT2 interrupts, as well as the INT interrupt when it is on 8-pin devices (where the INT pin is not on B0). This will be included in a future update to Flowcode, but I'm not sure when it will be released.

Wei - I'm not sure I understand your question. Can you explain more?

submarine
Posts: 10
Joined: Wed Feb 14, 2007 10:06 am
Contact:

Post by submarine »

Hello steve,

i explain more with a example.

PIC18F442 has interrupt-pins at RB0 RB1 and RB2.
But i want to use the pin RC1 as INT pin.

How can i do it?

thank

wei

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

I understand now.

You will not be able to use an interrupt for this. You will need to continually poll this pin (i.e. read its state) within your program and react accordingly.

submarine
Posts: 10
Joined: Wed Feb 14, 2007 10:06 am
Contact:

Post by submarine »

Thank you steve.

i still have a question.

can i use a interrupt pin as interrupt, wenn it is used as output?

what happens? wenn the pin has ein output, and come a inputsignal?

for example. PIC18F442, while the pin RB0/INT is programed as output, and now it is high(5V). and i want to make a interrupt, and i give a inputsignal(high) at RB0/INT.



wei

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:

Post by Benj »

Hello

If a pin is configured as an output then you cannot use it as an interrupt. You can read from the output as if it were an input but you are only actually reading the register that is controlling the output. To allow inputs you must set the specific bit in the tris register.

It is however possible to have an output 99% of the time and then change the tris to an input and monitor the pin for 1% of the time. You will have to be carefull if you are doing this not to put strain on the I/O pin. Eg connecting 5V input to a pin that is trying to output 0V will probably cause the pin damage unless you are using current limiting resistors.

submarine
Posts: 10
Joined: Wed Feb 14, 2007 10:06 am
Contact:

Post by submarine »

Hallo Ben,

thank you for the information.

i have tried to do it. just like you said. I have used a resistor before i connected 5V input to the pin.
but the pin has taken the output as a input, and interrupted :)

so i have to find another way to interrupt.

Have you some advices?

wei

Post Reply