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?
intterupt to specific part of program possible?
Moderator: Benj
- 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: intterupt to specific part of program possible?
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: intterupt to specific part of program possible?
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)
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)