HTBasic Help
×
Menu
Index

ON INTR Statement

 
The ON INTR statement defines an event branch to be taken when an interface card generates an interrupt. You specify the interface select code, an optional priority and the branch type. The branch type may be either a GOTO, GOSUB, CALL, or RECOVER. For example:
 
ON INTR 7,4 GOSUB Repair
 
When an interrupt occurs a DISABLE INTR for the interface is automatically executed. Consequently, an ENABLE INTR statement must be used to explicitly re-enable interrupts.
 
The default priority is one. The highest priority that can be specified is 15. ON END, ON ERROR, and ON TIMEOUT have a higher priority than ON INTR. When an INTR initiated branch is taken with a GOTO, the system priority is not changed. When an ON INTR branch specifies a CALL or GOSUB, the system priority is changed to the specified priority.
 
RECOVER causes the program to SUBEXIT from contexts as needed to return to the defining context and resume execution at the specified program line. ON INTR statements that specify CALL or RECOVER will be serviced even if the program context has been changed to another subprogram. ON INTR statements that specify GOTO or GOSUB will be logged and then serviced when control returns to the defining program context.
 
ON INTR is canceled by OFF INTR, disabled by DISABLE or DISABLE INTR. The following example shows how to detect the IEEE-488 service request (SRQ).
 
10   ON INTR 7 GOSUB 80 !Where to Go When Interrupt Occurs
20   ENABLE INTR 7;2    !Enable SRQ Interrupt
30     . . .
40     . . .
50     . . .
60   STOP
70   !
80   Val = SPOLL(701)   !Clear SRQ Line
90   ENTER 701;Condition!Read Device Condition
100  PRINT Condition
110  ENABLE INTR 7      !Re-Enable SRQ Interrupt
120  RETURN
130  END