Setint and 08M

retepsnikrep

Senior Member
Is it possible to use the setint command to setup an interrupt on an 08M so it interrupts when either Input 3 or 4 goes high?

I want the chip to be doing something very speed intensive but to perform some action if either input goes high.

I could use

if pin3 = 0 and pin4 = 0 then goto speed intensive process loop.

But I thought setint might be faster? I find the setint mask thing very confusing :(
 

Jeremy Leach

Senior Member
Well, the mask only tests for one condition of the pins, so the best way I know would be to have an OR gate that the inputs both feed into, then use the output of the OR gate to trigger the interrupt.

Fortunately an OR gate is very easy to make out of two diodes and a resistor:
Code:
   Input A ->|---.
                 |
                 |
                 |
   Input B ->|---o----------  A OR B
                 |
                 |
                .-.
                | |
                | |
                '-'
                 |
          o---------------o
 

Tag16c

New Member
Setint %00011000, %00011000

The command to set the int is Setint %00011000, %00011000. This command needs to be in your initalization routine. and at the end of your interupt routine juat before the return. A good example templet is in the Picaxe Manual2 page 180
Hope this helps.;)
Is it possible to use the setint command to setup an interrupt on an 08M so it interrupts when either Input 3 or 4 goes high?

I want the chip to be doing something very speed intensive but to perform some action if either input goes high.

I could use

if pin3 = 0 and pin4 = 0 then goto speed intensive process loop.

But I thought setint might be faster? I find the setint mask thing very confusing :(
 

kewakl

Senior Member
somewhere here is a post referencing using 'NOT' for the setint pattern.
interrupt if NOT (combination of pins).
search for it.
 

retepsnikrep

Senior Member
Well, the mask only tests for one condition of the pins, so the best way I know would be to have an OR gate that the inputs both feed into, then use the output of the OR gate to trigger the interrupt.

Fortunately an OR gate is very easy to make out of two diodes and a resistor:
Code:
   Input A ->|---.
                 |
                 |
                 |
   Input B ->|---o----------  A OR B
                 |
                 |
                .-.
                | |
                | |
                '-'
                 |
          o---------------o
Good idea but once the interrupt has triggered I then want to use

If pinx =1 to identify which input it was and act accordingly.

So I can't have both feeding into one pin.

With mask method (thanks for the example) is that truly (OR) or do both need to be high to interrupt? I'll have a play about.
 

Tag16c

New Member
Have the or input go into one of your interupt pins, then have (A) of your inputs (before the diode) go into a second input (only the or input will be an interupt) then test (A) for high or low if it is high it caused the interupt if not the other input caused the interupt.
 

Tag16c

New Member
The setint %00011000,%00011000 is only an "AND" interupt but using pin 3 as the "or" interupt pin as described above and using setint %00001000,%00001000 and then test pin 4 (before the diode)to see which one triggered it.
 

hippy

Ex-Staff (retired)
@ Jeremy, maybe just two ... (A), (A OR B ) ... if (A OR B ) triggers, and if A not set then it must have been B ( as per Tag16c's post ).

You'd have to have three inputs if you needed to determine if A, B or A&B were activated.

One thing to watch out for is that the state of the pins may not be the same when the interrupt is executed, that is if A is brief, it may trigger the interrupt but have been and gone before the interrupt is entered and the test is performed.
 
Top