© 1998 by AWC, All Rights Reserved
AWC
310 Ivy Glen Ct.
League City, TX 77573
stamp@al-williams.com
http://www.al-williams.com/awc/awce.htm
v1.1 25 Jan 99
!
!
©
¨
§
¦
¥
¤
£
¢
¡
Overview
The Stamp Pak III is an 8-bit I/O coprocessor with a versatile interface that makes it easy
to interface it with a variety of microcontrollers including the Basic Stamp from Parallax.
However, you can easily interface the Pak III with practically any modern
microprocessor. Here are some of the Pak III's major features:
•
Robust, speed independent serial interface
•
Uses as few as 2 pins to connect to the host
•
Can connect multiple devices to the same 2 pins with one additional pin per device
•
Works with Stamp II's ShiftOut and ShiftIn commands
•
Synchronous operation – read results when you are ready for them
•
Adds 8-bits of general-purpose digital I/O pins
•
64 bytes of EEPROM storage
•
Advanced I/O features (PWM, Count, Pulse I/O, etc.)
•
Easy to use
The Pak III is a standard 18-pin IC. In order to operate it must have a regulated supply of
5V and connection to a clock element. The Stamp Pak III includes a 10Mhz ceramic
resonator that you can use to clock the chip.
Other than the power and clock connections, the Pak III requires at least two wires to
connect between your microcontroller (the host) and itself. Depending on the host's
capabilities and your application, you may want to use more pins for I/O (up to 5 pins.
1
SIN
SOUT
CLK
RESET
Vss
B0
B1
B2
B3
BUSY/MODE
ENABLE/BUSY
RES2
RES1
Vdd
18
2
17
3
16
4
15
5
14
6
PAK-III
B7
B6
B5
B4
13
7
12
8
11
9
10
If You Need Help
If you require assistance with your PAK-III, please feel free to contact us. The best way
to get support is via e-mail (stamp@al-williams.com). However, you may also call
between 9AM - 4PM Central Time at (281) 334-4341. You can also fax to (281) 538-
2147. Be sure to check out our Web page for updates at
www.al-
williams.com/awc/awce.htm.
Registering Your PAK-III
Please take a moment to register your e-mail address with AWC. Simply send an e-mail
message to
aspreg@al-williams.com.
AWC will not make your address available to other
companies, but we may periodically send you updated technical notes. You’ll also
receive information about new microcontroller products and specials.
Pin Connections
Pin
18
Name
Busy/Mode
Type
Input/Output
Description
This pin has two functions. At start up, if the pin is
pulled up by a resistor, the PAK3 uses this pin as a
busy indicator. The pin will read 0 when the PAK3 is
not busy. However, if at startup the pin is pulled to
ground, the PAK3 will indicate its busy status on the
Enable/Busy pin.
If Busy/Mode is pulled high at start up, the
Enable/Busy pin is only an input. Bring it low to
disable the PAK3, or high to enable it. However, if
Busy/Mode is pulled low at start up, this pin serves as
an open-collector I/O pin. If the host pulls the pin
low, it disables the PAK3. If the PAK3 is busy, it
pulls the pin low.
The host pulses the CLK pin to shift data in or out of
the PAK3.
The PAK3 reads data from this pin. You may short
SIN and SOUT and use the same pin for input and
output if the host is capable of treating a single pin as
an I/O pin.
The PAK3 writes data to the host on this pin. Since
the pin is open collector, you'll need a resistor to 5V
on this pin. You may short SIN and SOUT together
to use one pin for I/O
Hardware resets the PAK3 when low.
Ground
+5V
Connects to resonator
Connects to resonator
General purpose I/O
17
Enable/Busy
Input or Open
Collector
Output
3
1
CLK
SIN
Input
Input
2
SOUT
Open Collector
Output
4
5
14
15
16
6-13
RESET
VSS
VDD
RES1
RES2
B0-B7
Input
Power
Power
Clock
Clock
I/O
Software Commands
Bit Pattern
0001BBB0
0001BBB1
0010BBB0
0010BBB1
0011BBB0
0100BBB0
0100BBB1
0101BBB0
0110BBB0
0110BBB1
0111BBB0
Name
INPUT
OUTPUT
LOW
HIGH
BITREAD
REVERSE
TOGGLE
PULSOUT
PULSIN0
PULSIN1
SHIFTIN
Argument
None
None
None
None
None
None
None
PLEN
None
None
MBITS
Returns
0
0
0
0
0 or 1
0
0
0
0,PLEN
0,PLEN
0,BYT
Description
Sets pin to input
Sets pin to output
Sets pin to output and set state low
Sets pin to output and set state high
Reads input pin
Sets input to output and vice versa
Toggles output pin
Pulses out (duration is a 16-bit word
specifying 4uS units)
Measures low pulse in 4uS units (PLEN is
16-bits)
Same as PULSIN0 but measures a high
pulse
Shift data in using pin as data and the next
pin as clock; MBITS specifies a mode and
bit length.
Shift data out using pin as data and the
next pin as clock; MBITS specifies a mode
and bit length
Counts transitions on pin for specified
period (16-bit word in 8uS units). Returns
16-bit count
PWM on pin with specified duty cycle
(byte) and period (2ms per unit; 16-bits)
Measure RC charge in 4uS units (16-bits)
Measure RC discharge in 4uS units (16-
bits)
Read EEPROM (address is a byte from 0-
63)
Writes EEPROM (address is a byte from
0-63)
Gets quasi-random byte
Turns off pull up resistors
Turns on pull up resistors
Makes single tone. Frequency is 16-bit
word (Hertz), Period is 16-bit word
(milliseconds)
Like FREQOUT, but makes two tones
0111BBB1
SHIFTOUT
MBITS, BYT
0
1000BBB0
COUNT
PER
0,CT
1001BBB0
1010BBB0
1010BBB1
10110000
10110010
10110011
11000000
11000001
1101BBB0
PWM
RCTIME0
RCTIME1
READ
WRITE
GETRAND
PULLOFF
PULLON
FREQOUT
DUTY, PER
None
None
ADDR
ADDR, BYT
None
None
None
FREQ,
PERIOD
FREQ, FREQ,
PERIOD
None
0
0,PLEN
0,PLEN
0,BYT
0
0,BYT
0
0
0
1101BBB1
FREQOUT2
0
10110110
CHECK
$31
Communications/version check
Notes and Key:
•
BBB = Bit number (0-7) corresponding to B0 to B7
•
PLEN = 16-bit word specifying pulse length in 4uS units
•
MBITS = 8-bit value. Top 4 bits specify mode (see reference); bottom 4 bits indicate bit length (1-8)
•
BYT = Byte value
•
PER = 16-bit period in 8uS units
•
DUTY = Byte indicating duty cycle in 1/255 units
•
ADDR = EEPROM address (byte) from 0 to 63
•
FREQ = Frequency (16-bits) in Hertz
•
PERIOD = Duration (16-bits) in milliseconds