SETINTFLAGS AND flags,mask
SETINTFLAGS OR flags,mask
SETINTFLAGS NOT flags,mask
Flags - a variable/constant (0-255) which specifies flags byte condition.
Mask - is variable/constant (0-255) which specifies the mask.
Interrupt on a certain 'flags' byte condition.
Please also see the detailed usage notes under the 'setint' command, which also apply to the 'setintflags' command. Only one interrupt can be active at any time.
The setintflags command causes a polled interrupt on a certain flags condition. A polled interrupt is a quicker way of reacting to a particular event. It is the only type of interrupt available in the PICAXE system. The flags byte is checked between execution of each command line in the program, between each note of a tune command, and continuously during any pause command. If the particular inputs condition is true, a 'gosub' to the interrupt sub-procedure is executed immediately. When the sub-procedure has been carried out, program execution continues from the main program.
The interrupt inputs condition is any pattern of '0's and '1's on the flags byte masked by the byte 'mask'. Therefore any bits masked by a '0' in byte mask will be ignored. The system 'flags' byte is broken down into individual bit variables. See the appropriate command for more specific details about each flag.
Name Special Function Command flag0 hint0flag X2 parts - interrupt on INT0 hintsetup flag1 hint1flag X2 parts - interrupt on INT1 hintsetup flag2 hint2flag X2 parts - interrupt on INT2 hintsetup flag3 hintflag X2 parts - interrupt on any pin 0,1,2 hintsetup flag4 compflag X2 parts - comparator flag compsetup flag5 hserflag hserial background receive has occurred hsersetup flag6 hi2cflag hi2c write has occurred (slave mode) hi2csetup flag7 toflag timer overflow flag settimer
Therefore, interupts can easily be generated on specific events:
setintflags: %10000000,%10000000 to interrupt on timer overflow setintflags %01000000,%01000000 to interrupt on hi2c write (slave mode) setintflags %00100000,%00100000 to interrupt on background hardware serial receive
Only one input pattern is allowed at any time. To disable the interrupt execute a 'setintflags off' command. For more information about the various setintflags options (AND / OR / NOT) please see the setint command.
Submit Your Own Code!
You must be logged in to submit code examples. Login now.