deboun.bas

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

BAS
25
字号
'-----------------------------------------------------
'                 DEBOUN.BAS
'           Demonstrates DEBOUNCE
'-----------------------------------------------------
CONFIG DEBOUNCE = 30  'when the config statement is not used a default of 25mS will be used

  'Debounce P1.1 , 1 , Pr 'try this for branching when high(1)
  Debounce P1.0 , 0 , Pr , Sub
  Debounce P1.0 , 0 , Pr , Sub
  '                    ^----- label to branch to
  '               ^---------- Branch when P1.0 goes low(0)
  '         ^---------------- Examine P1.0

  'When P1.0 goes low jump to subroutine Pr
  'P1.0 must go high again before it jumps again
  'to the label Pr when P1.0 is low

  Debounce P1.0 , 1                       'no branch
  Debounce P1.0 , 1 , Pr                  'will result in a return without gosub
End

Pr:
  Print "P1.0 was/is low"
Return

⌨️ 快捷键说明

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