timer2c.bas

来自「82 sample programs written in BASCOM-805」· BAS 代码 · 共 26 行

BAS
26
字号
'--------------------------------------------------------------
'                     (c) 1998-2000 MCS Electronics
'--------------------------------------------------------------
'  file: TIMER2c.BAS
'  *TIMER2 used as a clockgenerator
'  Select 8052.dat or 89s8252.dat
'--------------------------------------------------------------
Dim C As Word

'--------------- TIMER 2 modes ------------------
'0=16-bit auto reload
'1=16-bit capture
'2=baudrate generator
'3=receive only
'4=transmit only
'5=clock output
'------------------------------------------------
Config Timer2 = Timer , Mode = 5
' The output frequency = (fOSC / 4) / (65536-CAPTURE)
' So when used with 12Mhz clock the minimum freq would be
' (12/4)=3000000 / (65535)=
' The maximum freq would be : 46 Hz
' 3000000 / 1 = 3 MHz.

Capture = 65535                         'will produce 3MHz
End

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?