?? ex03 - led counter.bs2
字號:
' {$STAMP BS2}
' ==============================================================================
'
' File...... Ex03 - LED Counter.BS2
' Purpose... Binary Counter
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' Started...
' Updated... 01 MAY 2002
'
'
' ==============================================================================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' Displays a binary counter on Pins 0 - 7
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
LEDs VAR OutL ' LEDs on Pins 0 - 7
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
MinCount CON 0 ' counter start value
MaxCount CON 255 ' counter end value
DelayTime CON 100 ' delay time in milliseconds
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
counter VAR Byte
' ------------------------------------------------------------------------------
' Initialization
' ------------------------------------------------------------------------------
Initialize:
DirL = %11111111 ' make pins 0 - 7 outputs
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
FOR counter = MinCount TO MaxCount ' loop through all count values
LEDs = counter ' show count on LEDs
PAUSE DelayTime ' pause before next number
NEXT
GOTO Main ' do it again
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -