STOP TIMERx
Action

Stop the specified timer/counter.

Syntax

STOP timer

Remarks

timer TIMER0, TIMER1, TIMER2, COUNTER0 or COUNTER1.
You can stop a timer when you don't want an interrupt to occur.

TIMER0 and COUNTER0 are the same.


See also
START TIMERx


Example


'--------------------------------------------------------------
' (c) 1997,1998 MCS Electronics
'--------------------------------------------------------------
' file: TIMER0.BAS
' demo: ON TIMER0
' *TIMER1 is used for RS-232 baud rate generator
'--------------------------------------------------------------

Dim Count As Byte , Gt As Byte

Config Timer0 = Timer , Gate = Internal , Mode = 2
'Timer0 = counter : timer0 operates as a counter
'Gate = Internal : no external gate control
'Mode = 2 : 8-bit auto reload (default)

On Timer0 Timer_0_int
Load Timer0 , 100 'when the timer reaches 100 an interrupt will occur
Enable Interrupts 'enable the use of interrupts
Enable Timer0 'enable the timer

Rem Setting Of Priority
Priority Set Timer0 'highest priority
Start Timer0 'start the timer

Count = 0 'reset counter
Do
Input
"Number " , Gt
Print "You entered : " ; Gt
Loop Until Gt = 1 'loop until users presses ESC key
Stop Timer0
End


Rem The Interrupt Handler For The Timer0 Interrupt
Timer_0_int:
Inc Count
If Count = 2 Then
Print "Timer0 Interrupt occurred"

Count = 0
End If
Return