Page 1 of 1

intterupt to specific part of program possible?

Posted: Mon Feb 22, 2010 2:33 pm
by wtulp
Hello,

I have write a program which simulates the flashlight from a car.
When i press the switch to stop the flashlight the lights doesn't stop direct.
I want the lights stopped direct when a switch is turned off.

Is it possible with an intterupt (B4 - B7) to jump to an specific part (or line) of the program?
I have tried to reset the program, with an interrupt, with the following C-code but then it looks like the program hangs in the interrupt:

//perform a reset
pclath = 0;
pcl = 0;

Can someone please help me?
Knipperlicht.fcf

Re: intterupt to specific part of program possible?

Posted: Mon Feb 22, 2010 2:37 pm
by wtulp
Excuse me,

This is the program:
Knipperlicht.fcf
(23.64 KiB) Downloaded 370 times

Re: intterupt to specific part of program possible?

Posted: Mon Feb 22, 2010 3:01 pm
by Benj
Hello

The interrupts can only jump to a macro.

Maybe you could change the program so you switch the light off in the interrupt macro. This way the light would go out as soon as the interrupt is triggered.

Re: intterupt to specific part of program possible?

Posted: Mon Feb 22, 2010 3:19 pm
by wtulp
Hello Benj,

Thanks for the reply.

The lights on/off is done with a loop (is it possible to jump out the loop with a intterupt?)
Or is it maybe better not to work with loops at all?

Other question:
The interrupts for portB (B4-B7) is triggered when a switch is turned on or off. (is this right?)
Is it possible that the intterupt only triggered when a switch is turned off.
(I use the processor PIC16F877a)