© 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 IV is a16-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 IV with practically any modern
microprocessor. Here are some of the Pak IV'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 16-bits of general-purpose digital I/O pins
•
96 bytes of RAM storage
•
Advanced I/O features (PWM, Count, Pulse I/O, etc.)
•
Easy to use
The Pak IV is a 28-pin .3" wide IC. In order to operate it must have a regulated supply of
5V and connection to a clock element. The Stamp Pak IV includes a 20Mhz ceramic
resonator that you can use to clock the chip.
Other than the power and clock connections, the Pak IV 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
RESET
ENABLE/BUSY
A7
A6
28
2
27
3
26
BUSY/MODE
4
A5
25
SIN
5
A4
A3
A2
A1
22
24
SOUT
CLK
6
23
7
Vss
8
PAK-IV
Vss
A0
RES1
Vdd
Vss
B7
B6
B5
B4
21
9
20
10
RES2
B0
19
11
18
12
B1
13
17
B2
14
16
B3
15
If You Need Help
If you require assistance with your PAK-IV, 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-IV
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
3
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 – connect both pins to ground
+5V
Connects to resonator
Connects to resonator
General purpose I/O (BANK A)
General purpose I/O (BANK B)
2
Enable/Busy
Input or Open
Collector
Output
6
4
CLK
SIN
Input
Input
5
SOUT
Open Collector
Output
1
8, 19
20
9
10
21-28
11-18
RESET
VSS
VDD
RES1
RES2
A0-A7
B0-B7
Input
Power
Power
Clock
Clock
I/O
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 2uS units)
Measures low pulse in 2uS 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 4uS units).
Returns 16-bit count
PWM on pin with specified duty cycle
(byte) and period (1ms per unit; 16-
bits)
Measure RC charge in 2uS units (16-
bits)
Measure RC discharge in 2uS units
(16-bits)
Read RAM (address from 0-$5F)
Writes RAM (address from 0-$5F)
Gets quasi-random byte
Turns off pull up resistors on BANK A
Turns on pull up resistors on BANK A
Makes single tone. Frequency is 16-bits
(Hertz), Period is 16-bits (milliseconds)
Like FREQOUT, but makes two tones
Communications/version check
Select BANK A (X=0) or BANK B
(X=1)
0111BBB1
SHIFTOUT
MBITS, BYT
0
1000BBB0
COUNT
PER
0,CT
1001BBB0
PWM
DUTY, PER
0
1010BBB0
1010BBB1
10110000
10110010
10110011
11000000
11000001
1101BBB0
1101BBB1
10110110
1011100X
RCTIME0
RCTIME1
READ
WRITE
GETRAND
PULLOFF
PULLON
FREQOUT
FREQOUT2
CHECK
BANKSEL
None
None
ADDR
ADDR, BYT
None
None
None
FREQ,
PERIOD
FREQ, FREQ,
PERIOD
None
None
0,PLEN
0,PLEN
0,BYT
0
0,BYT
0
0
0
0
$41
0
Notes and Key:
•
BBB = Bit number (0-7) corresponding to B0 to B7
•
PLEN = 16-bit word specifying pulse length in 2uS 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 4uS units
•
DUTY = Byte indicating duty cycle in 1/255 units
•
ADDR = RAM address (byte) from 0 to $5F
•
FREQ = Frequency (16-bits) in Hertz
•
PERIOD = Duration (16-bits) in milliseconds