27297 Parallax Inc, 27297 Datasheet - Page 107
27297
Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet
1.27297.pdf
(230 pages)
Specifications of 27297
Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
- Current page: 107 of 230
- Download datasheet (3Mb)
Here’s the modified subroutine:
The real work is done by this line of code:
The current button state (nBtns) is compared with the previous scan value (oBtns)
using the Exclusive OR (^) operator. This will cause a bit to be ‘1’ when there is a
difference between the previous scan and the current. This [comparison] value is
then ANDed with nBtns which holds ‘1’ for each pressed button. The result is that
xBtns will have a ‘1’ for each button that was ‘0’ on the last scan and is ‘1’ on this
scan.
Note that if the button remains pressed and Get_Buttons is called again, the
respective bit of xBtns will change from ‘1’ to ‘0’ since there was no change of
button state.
See listing SW21-EX14-Debounce-Adv.BS2 for a full demonstration.
Take it Further
Modify the program to scan, debounce, and display eight buttons (Hint: Use INL or
INH).
Get_Buttons:
nBtns = %1111
FOR idx = 1 TO 5
NEXT
xBtns = nBtns ^ oBtns & nBtns
oBtns = nBtns
RETURN
xBtns = nBtns ^ oBtns & nBtns
nBtns = nBtns & ~BtnBus
PAUSE 5
' enable all four inputs
' test new inputs
' delay between tests
' look for 0 -> 1 changes
' save this scan
' look for 0 -> 1 changes
Related parts for 27297
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: