Interrupts, simple question

angrypirate

New Member
I'm trying to set a picaxe 18x to interrupt on pin0 or pin1 or pin7 going high but cant seem to make it work. I can get 0 or 1 but cant seem to get beyond that.
 

Xarren

Member
init:
setint %10000011,%10000011
main:
Rest of your code...
interrupt:
whatever you want your code to do...
setint %10000011,%10000011
 

inglewoodpete

Senior Member
I think Xarren missed angry's requirement: 0 OR 1 OR 7

The only easy way to interrupt on 1 of several pins on an 18X is to diode-OR all required inputs to 1 pin (say pin0), with a pull up/down resistor on that pin. The interrupt mask would only monitor the 1 pin. When the interrupt routine fires, it will need to check all appropriate inputs to determine which one caused the interrupt.

Not perfect but it is a polled interrupt, not event-driven.

Peter
 

Technical

Technical Support
Staff member
Normally you would do this via

- setint NOT %00000000,%10000011

so if either 0, 1, or 7 beccomes 1 the interrupt triggers


However SETINT NOT is only available on X1,X2 parts, so diode mixing hardware as already suggested is the best option for 18X.
 

MFB

Senior Member
Technical, Is it possible to use setin to trigger an interrupt from the X1 internal timer, without adding an external link? This would be useful for scanning ADC channels at regular intervals for data logging applications.
 
Top