Interrupt Help

westaust55

Moderator
Interrupts

Not clear exactly what you are trying achieve.

You can only have one SETINT instruction in operation at a time.
When an interrupt occurs execution transfers to a subroutine called Interrupt:
That subroutine must end in a RETURN instruction.
Also when an interrupt occurs the SETINT is disabled and if you wish to perform further interrupts you must use the SETINT instruction.


You can turn the interrupt function off. After that, you enable the SETINT again with changed parameters - but it will still goto to the same subroutine called Interrupt:
 
Last edited:

BeanieBots

Moderator
If you mean can you have two interrupt routines which are jumped to depending on which pin interruted, then no.
However, it is very easy to check which pin caused the interrupt and then jump accordingly.
 

nyyankeehater

New Member
This is what I have as of now :
Code:
let dirs = %00010111
Setint %00001000,%00001000
pattern0:
do
let pins = %00010111
let pins = %00000000
let pins = %00010111
pause 100
let pins = %00000000
pause 250
loop

Interrupt:

pattern1:
let pins = %00010001
let pins = %00000110
let pins = %00000110
let pins = %00010001
goto pattern1
setint off


pattern2:
let pins = %00000011
let pins = %00010100
pause 80
let pins = %00010100
let pins = %00000011
goto pattern2
what I would like it to do next is go to pattern 2 when a push button is activated. Is this possible? (im not asking anyone to write the code just point me in the proper direction)
________
Buy Marijuana Seeds
 
Last edited:

Artie2

New Member
While I'm new to Picaxe, I've been playing with BASIC for years. One of the ways I approach a problem like this is to use the interrupt just to set a "test" flag. Then test that flag wherever in the program you need. for example:

Code:
test=0 ' at beginning of program 
.
.
.
 
Interrupt:
test=test+1
return
 
On test goto test0, test1, test2, etc ' this can be anywhere, as many times as you want.
Now, one interrupt, can detect any number of key presses.
This gives you almost unlimited interrupts. (Within the limits of the chip.)
 
Last edited:
Top