📄 timer0.bas
字号:
'--------------------------------------------------------------
' (c) 1997-2001 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -