27220 Parallax Inc, 27220 Datasheet - Page 109
27220
Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet
1.27220.pdf
(230 pages)
Specifications of 27220
Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
- 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 27220
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: