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
Example
'--------------------------------------------------------------
' (c) 1995-2006 MCS Electronics
'--------------------------------------------------------------
' file: TIMER0.BAS
' demo: ON TIMER0
' *TIMER1 is used for RS-232 baudrate 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 enters 1
Stop Timer0
End
Rem The Interrupt Handler For The Timer0 Interrupt
Timer_0_int:
Inc Count
If Count = 250 Then
Print "Timer0 Interrupt occured"
Count = 0
End If
Return