📄 counter.bas
字号:
'--------------------------------------------------------------
' (c) 1997-2001 MCS Electronics
'--------------------------------------------------------------
' file: COUNTER.BAS
' demo: COUNTER
'--------------------------------------------------------------
' Connect the timer input P3.4 to a frequency generator
' *TIMER/COUNTER 1 is used for RS-232 baud rate generator
'--------------------------------------------------------------
Dim A As Byte , C As Integer
Config Timer0 = Counter , Gate = Internal , Mode = 1
'Timer0 = counter : timer0 operates as a counter
'Gate = Internal : no external gate control
'Mode = 1 : 16-bit counter
Counter0 = 0 'clear counter
Start Counter0 'enable the counter to count
Do 'set up a loop
A = Inkey 'check for input
C = Counter0 'get counter value
Print C 'print it
Start Counter0 're-start it because it was stopped by accessing the COUNTER
Loop Until A = 27 'until escape is pressed
End
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -