ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 12.06.2025
Просмотров: 8319
Скачиваний: 1
© MCS Electronics, 1995-2007
Action
Configures the delay time for the DEBOUNCE statement.
Syntax
CONFIG DEBOUNCE = time
Remarks
Time |
A numeric constant which specifies the delay time in mS. |
When debounce time is not configured, 25 mS will be used as a default.
See also
DEBOUNCE
Example
'----------------------------------------------------------------------------- |
|
------------ |
: deboun.bas |
'name |
|
'copyright |
: (c) 1995-2005, MCS Electronics |
'purpose |
: demonstrates DEBOUNCE |
'micro |
: Mega48 |
'suited for demo |
: yes |
'commercial addon needed |
: no |
'-----------------------------------------------------------------------------
------------
$regfile = "m48def.dat" |
' specify the used |
micro |
' used crystal |
$crystal = 4000000 |
|
frequency |
' use baud rate |
$baud = 19200 |
|
$hwstack = 32 |
' default use 32 |
for the hardware stack |
' default use 10 |
$swstack = 10 |
|
for the SW stack |
' default use 40 |
$framesize = 40 |
|
for the frame space |
|
Config Debounce = 30 |
'when the config |
statement is not used a default of 25mS will be used |
'Debounce Pind.0 , 1 , Pr 'try this for branching when high(1)
Debounce Pind.0 , |
0 |
, Pr , Sub |
|||
Debounce Pind.0 , |
0 |
, Pr , Sub |
|||
' |
^ |
^----- |
label to branch to |
||
' |
^ |
Branch when P1.0 goes low(0) |
|||
' |
Examine P1.0 |
||||
'When Pind.0 goes low jump to subroutine Pr 'Pind.0 must go high again before it jumps again 'to the label Pr when Pind.0 is low
Debounce |
Pind.0 |
, |
1 |
, |
Pr |
'no branch |
Debounce |
Pind.0 |
, |
1 |
, |
Pr |
'will result in a |
return without gosub
End
page -338-