intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 4.20 DESCRIPTION OF STATEMENTS If the programmer does not want this delay, a variable should be assigned to the SPECIAL FUNCTION OPERATOR, TIME, at the beginning of the interrupt routine. EXAMPLE: >10 TIME=0 : CLOCK1 : ONTIME 2,100 DO >20 WHILE TIME >100 A=TIME >110 PRINT "TIMER INTERRUPT AT -",A,"SECONDS" >120 ONTIME A+2,100 : RETI >RUN TIMER INTERRUPT AT - 2 SECONDS TIMER INTERRUPT AT - 4 SECONDS TIMER INTERRUPT AT - 6 SECONDS TIMER INTERRUPT AT - 8 SECONDS TIMER INTERRUPT AT - 10 SECONDS READY Like the ONEX1 statement, the ONTIME interrupt routine must be exited with a RETI statement. Failure to do this will "lock-out" all future interrupts.

The ONTIME interrupt has priority over the ONEX1 interrupt. This means that the ONTIME interrupt can interrupt the ONEX1 interrupt routine. This priority was established because time related functions in control applications were viewed as critical routines. If the user does not want the ONEX1 routine to be interrupted by the ONTIME interrupt, a CLOCK0 or a CLEARI statement should be executed at the beginning of the ONEX1 routine. The interrupts would have to be re-enabled before the end of the ONEX1 routine. The ONEX1 interrupt cannot interrupt an ONTIME routine. The ONTIME statement in MCS BASIC-52 is unique, relative to most BASICS.

This powerful statement eliminates the need for the user to "test" the value of the TIME operator periodically throughout the BASIC program. - 53 -