kranenborg
14-08-2004, 22:26
The current implementation of the SETINT command implictly assumes an "AND" condition on the inputs as specified by the "mask" (subject to the input conditions as prescribed by the "input" variable/constant) for the interrupt routine to be called. I think this choice has serious drawbacks for the following reasons:
1) Interrupts are mostly asynchronous by nature, so in general {condition xxx OR condition yyy} should trigger an interrupt, not {condition xxx AND condition yyy}.
2) To implement 1) (i.e. the OR) external components (diodes) are necessary -even in the most simple situations, plus an extra interrupt input pin has to be sacrified. (i.e. 3 input pins for 2 "ORed" interrupts), which counts heavily on the 08/08-M.
3) The retrieval of information on which input pin(s) caused the interrupt currently needs to be done by one or possibly even two separate BASIC commands, causing a relatively long time delays, whilst an interrupt service routine should be as quick as possible
4) The implicit AND approach is incompatible with other processors (Basic Stamp for example)
I therefore propose the following backward-compatible extension:
SETINT input,mask,AND/OR(opt.),reason(opt.)
where AND or OR describe the condition of the interrupt action (optional keyword, if not present AND is assumed for compatibility), and the "reason" variable contains "1"s on those positions where the corresponding inputs have caused the interrupt (of course in agreement with the settings of both the "input" and "mask" variable/constants ). Again, "reason" is optional for compatibility reasons. Implemented in this way the "reason" variable can be used directly to jump to the appropriate service routines.
Â*
1) Interrupts are mostly asynchronous by nature, so in general {condition xxx OR condition yyy} should trigger an interrupt, not {condition xxx AND condition yyy}.
2) To implement 1) (i.e. the OR) external components (diodes) are necessary -even in the most simple situations, plus an extra interrupt input pin has to be sacrified. (i.e. 3 input pins for 2 "ORed" interrupts), which counts heavily on the 08/08-M.
3) The retrieval of information on which input pin(s) caused the interrupt currently needs to be done by one or possibly even two separate BASIC commands, causing a relatively long time delays, whilst an interrupt service routine should be as quick as possible
4) The implicit AND approach is incompatible with other processors (Basic Stamp for example)
I therefore propose the following backward-compatible extension:
SETINT input,mask,AND/OR(opt.),reason(opt.)
where AND or OR describe the condition of the interrupt action (optional keyword, if not present AND is assumed for compatibility), and the "reason" variable contains "1"s on those positions where the corresponding inputs have caused the interrupt (of course in agreement with the settings of both the "input" and "mask" variable/constants ). Again, "reason" is optional for compatibility reasons. Implemented in this way the "reason" variable can be used directly to jump to the appropriate service routines.
Â*