27297 Parallax Inc, 27297 Datasheet - Page 109
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: 109 of 230
- Download datasheet (3Mb)
' -----[ Program Code ]----------------------------------------------------
Main:
' -----[ Subroutines ]-----------------------------------------------------
Wait_For_Count:
Behind the Scenes
The purpose of the Wait_For_Count subroutine is to cause the program to wait
for a specified number of events. In an industrial setting, for example a packaging
system, we might need to run a conveyor belt until 100 boxes pass a sensor.
As you can see we’ve built upon the “pro” technique explored in the previous
chapter. At the top of the loop the input state is captured in nScan, and then
compared to the previous state (oScan) to detect a change (saved in xScan).
When the input has changed from ‘0’ to ‘1’ between scans the event count is
updated and displayed. The reason for capturing the input before the comparison is
to prevent the possibility of being affected by an input state change while processing
the comparison line.
Note that displaying the current event count in the middle of the Wait_For_Count
subroutine does put a limit on the rate of change the subroutine can accommodate.
DEBUG CLS,
target = 25
GOSUB Wait_For_Count
DEBUG "Count complete."
END
DO
LOOP UNTIL (eCount = target)
RETURN
nScan = EventIn
xScan = nScan ^ oScan & nScan
oScan = nScan
IF (xScan = 1) THEN
ENDIF
eCount = eCount + 1
DEBUG CRSRXY, 0, 1,
"Started...", CR
"Count = ", DEC eCount, CR
' set target value
' wait for 25 pulses
' capture input
' look for 0 -> 1 change
' save this scan
' add new event
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: