Question about the timer interrupt

Zati

New Member
Hi!

I'm trying to use the timer interrupt (toflag) by writing 'settimer X' in the Programming Editor. X is a random number, e.g. 1000.

This is where all goes wrong, because the Programming Editor says:

settimer 1000
^

Error: Syntax error in this line!

What's the problem?

I've set the interrupt active at the beginning of my code by writing:

setintflags %10000000,%10000000

When I do get that interrupt to work, how do I clear the interrupt flag?
(I tried let toflag=0, but the Editor gave the syntax error again..)

I'm using the 18X-chip

Thanks for any assitance!
 

benryves

Senior Member
Welcome to the PICAXE forum. :) settimer (and interrupting on timer overflow) is only available on the 20X2, 28X1/28X2 and 40X1/40X2 parts - which is why it's not working on your 18X. When reading the BASIC manual, there's a diagram to the left of each command that shows which parts the command works on.

If you need to use an interrupt timer I suppose one way could be to use an external timer (even just a 555) to trigger an interrupt on one of the PICAXE-18X's pins. Alternatively, you could restructure your code to not rely on an interrupt.
 
Top