27297 Parallax Inc, 27297 Datasheet - Page 37

KIT STAMPWORKS WITH BS2-IC

27297

Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet

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
Part Number:
27297SQ
Manufacturer:
NS
Quantity:
4
Program: SW21-EX01-Flash_LED.BS2:
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Program Description ]---------------------------------------------
'
' Flashes an LED connected to P0.
' any BS2-family module.
' -----[ I/O Definitions ]-------------------------------------------------
AlarmLed
' -----[ Constants ]-------------------------------------------------------
FlashTm
' -----[ Program Code ]----------------------------------------------------
Main:
Behind the Scenes
Each of the BASIC Stamp’s I/O pins has three bits associated with its control. A bit in
the DIRS register determines whether the pin is an input (bit = 0) or an output (bit
= 1). If the pin is configured as an output, the current state of that pin is stored in
the associated bit in the OUTS register. If the pin is configured as an input, the
current pin value is taken from the associated bit in the INS register.
HIGH and LOW actually perform two functions with one command: the selected pin
is configured as an output (1 in the DIRS register) and the state bit is modified in
the OUTS register (1 for HIGH, 0 for LOW).
HIGH AlarmLed
PAUSE FlashTm
LOW AlarmLed
PAUSE FlashTm
GOTO Main
PIN
CON
0
500
This program will work, unmodified, on
' LED on P0
' delay 500 milliseconds
' turn the LED on
' turn the LED off

Related parts for 27297