30064 Parallax Inc, 30064 Datasheet - Page 8

STAMP PLC

30064

Manufacturer Part Number
30064
Description
STAMP PLC
Manufacturer
Parallax Inc
Datasheet

Specifications of 30064

Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
Module/board Type
-
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
Other names
Q2172565
down they will automatically start up. The BASIC Stamp does not know if this happens, so again, devote
a significant amount of time to think about how to make your program and how the Stamp PLC is
connected absolutely fail-safe. The diagram to the right depicts how to connect an output device, and
the output power supply, to the Stamp PLC.
Reading Digital Inputs
Digital inputs 1-8 are multiplexed (or grouped) into three I/O lines courtesy of a 74HC165 parallel in -
serial out shift register. All Stamps have a built-in command (SHIFTIN) to assist in reading this type of
device. When the 74HC165 is read, the status of the inputs will be loaded into the corresponding bits of
the variable InBits. The following program will retrieve and display digital inputs 1-8.
'{$STAMP BS2}
'{$PBASIC 2.5}
inBits
Clk
Load
Dat
Main:
Inputs 9-10 are accessed directly. They are not part of the shift register, and as a result, have their own
addresses. Input 9's I/O address is 6, and input 10's I/O address is 7. The following program listing
shows how to access Inputs 9 and 10, and does so using conditional branching statements.
'{$STAMP BS2}
'{$PBASIC 2.5}
Parallax, Inc. • Stamp PLC (#30064) • Version 1.8 • 12/29/2003
DO
LOOP
HIGH Load
SHIFTIN Dat,Clk, MSBPRE, [inBits]
LOW Load
DEBUG "Digital Inputs:", IBIN8 inBits, CR
PAUSE 1000
VAR
PIN
PIN
PIN
Byte
0
1
2
+24VDC
Vss
Figure 8: Typical Input Connection
' Stamp type directive
' Stamp expanded syntax directive
' inBits contains inputs 1-8
' Get 8 inputs from shift-register
' Display 8 inputs in a binary fashion
' Wait for 1 second
' then repeat
' Stamp type directive
' Stamp expanded syntax directive
S
S
ATN
GND
D 1
D 2
D 3
D 4
D 5
D 6
D 7
D 8
D 9
D 10
D GND
+24 VDC
GND
OUT
IN
IN
IN
IN
IN
IN
IN
IN
IN
IN
IN
IN
www.parallax.com
#30064
OUT 5VDC
D
OUT
A GND
A GND
D
IN
IN
OUT
D
D
D
D
D
D
D
D
OUT
OUT
OUT
OUT
OUT
OUT
OUT
OUT
A 1
A 2
A 3
A 4
GND
IN
IN
IN
IN
V+
1
2
3
4
5
6
7
8
Page
8

Related parts for 30064