Part Number Hot Search : 
CPH3104 LA7051 00505 SS2003M 05L01 1N4006G CM201 MP12500
Product Description
Full Text Search
 

To Download PAK-IV Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 (c) 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
"
"
!



(c)
|

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) 5382147. Be sure to check out our Web page for updates at www.alwilliams.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; 16bits) Measure RC charge in 2uS units (16bits) 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
I/O Considerations
Each I/O pin on the Pak IV can sink 25mA or source 20mA subject to a total limit of 150mA total sink and 100mA total source. Inputs consider voltages below .8V as a 0 and voltages greater than 2.4V as a 1. Outputs will be less than .6V or greater than 4.3V (for a 1 or a 0, respectively). The PAK IV's I/O pins are divided into two groups of 8, BANK A and BANK B. By default, the unit starts with BANK A active. You can switch to either bank by issuing a BANKSEL command.
Resetting
There are several ways you can reset the Pak IV. It is a good idea to reset the unit before using it, or any time that you want to make sure it is in a known state. This is especially true when using the Stamp. Each time the Stamp resets or wakes up from sleep, the I/O pins briefly become inputs. This can fool the Pak IV into starting a data transfer. Always reset the Pak IV first. The best way to reset the Pak IV (when using only one unit) is to send a special reset sequence over the clock and data lines. This has the advantage that it doesn't require any extra I/O from the host. To send a reset sequence, bring the data pin to 0 and raise the clock to a 1. While the clock remains in the 1 state, bring the data pin high. This will indicate to the Pak IV that you wish to reset. When the clock returns to a zero state, the Pak IV will reset. The reset doesn't change any register values or port pins, but it does reset communications to a known state. Reset in this way does not affect the currently selected I/O bank, either. You can get the same result by bringing the enable pin low and then returning it to high to enable the Pak IV. This is useful if you are connecting more than one Pak to the same data and clock lines. You'll need to use the enable pin then anyway, and it makes sure that the selected Pak is always in a known state. Don't use the data line reset when using multiple Paks on the same clock and data lines. Finally, you can force a hardware reset by bringing the reset pin low. This might be useful if your circuit generates a hardware reset signal based on a brown-out detector or other master reset circuit. Normally, you'll just connect the reset pin to the +5V supply and allow the Pak IV to reset itself on power up. If you do want to drive this pin, make sure that it is at 5V for normal operation. You can use a reset switch or other device if you pull up the reset pin with a 10K-22K resistor. This is the only reset that will interrupt an operation in progress.
Communications
There are several schemes you can use to communicate with the Pak IV. All of them revolve around a synchronous protocol involving a clock pin and 1 or 2 data pins. Data is shifted most significant bit first, and samples at the rising edge of the clock. The Pak IV exposes a separate input (SIN) and output (SOUT) pins for hosts that can't easily handle
bi-directional I/O lines. However, for hosts like the Stamp or PIC, it is a simple matter to tie these lines together since SOUT is open collector. Therefore, the minimum number of lines you need are two. An output for the clock and an I/O line to connect to SIN and SOUT. You'll connect the Enable/Busy pin to +5V and use a pull up resistor to 5V on the Busy/Mode pin. This allows you to reset the device and communicate with it. The only problem is, you will have to make sure not to ask the device for data while it is processing. Most operations are quite fast, but some operations (generating a tone, or writing to EEPROM, for example) can take a long time depending on what parameters you specify. If you need to disable and enable the device, you'll want to drive the Enable/Busy pin. Using this pin allows you to share the SIN, SOUT, and CLK lines with other devices that use a similar protocol. So to connect 5 Paks you'd only need 7 I/O lines (5 enables, 1 SIN/SOUT, and 1 CLK line). You drive the Enable/Busy pin low to disable the device. If you don't plan to use this capability, just pull the pin high with a pull up resistor. If you are using the Busy/Mode input (see below) you can still use a pull up resistor, or just tie the Enable/Busy pin directly to +5V. If you ground the Busy/Mode input at start up, the device will also use the Enable/Busy pin to tell you when it is unavailable. It does this by driving the line low when it is not ready. That means the host must drive the pin with an open collector output if it wants to disable the device. If you don't need to disable the device, you can just connect the pin to a pull up resistor and connect the Enable/Busy pin to an input on the host. If you want to use a normal output to drive the Enable/Busy pin, but you still want a busy indication, you can connect the Busy/Mode pin to 5V through a pull up resistor. Then the Pak IV will use the Busy/Mode pin to signify it is busy (the pin is high when busy). In this case, the Enable/Busy pin is always an input and you can drive it normally. One thing to note about the status return: All of the commands will return zeros in the top bit of the response. You can use this as a form of busy indication if you are unwilling to use any other pins. Simply read the data pin until it is zero. This indicates that the device is sending the response. The READX and RIO commands do not follow this convention, but they take very little time to execute anyway (less than 4 uS). To summarize, here are the ways you can synchronize with the Pak IV: 1. Monitor the Enable/Busy line while Busy/Mode is grounded. If you bring Enable/Busy low it indicates that the Pak IV is disabled. If the Pak IV brings the pin low, it means it is engaged in operations. 2. Place a pull up resistor on the Busy/Mode pin. This will cause the Busy/Mode pin to be high when the Pak IV is busy. 3. Wait until the data pin goes low before reading responses.
Command Reference
BANKSEL Selects BANK A or BANK B I/O. All operations that require a pin number (from 0 to 7) will use the currently selected bank. BITREAD Reads the logical state of the specified pin (1 or 0). This command does not automatically force the pin into the input state. Returns a 0 or 1 byte. CHECK Communications check and version identify. Always returns $41 ($4 for this PAK, 1 for version number). COUNT Count returns the number of transitions on the specified pin during the interval you ask for. Send the period (16-bits) in 4uS units. The PAK-IV will return a zero and the 16-bit count. FREQOUT This command emits a tone for a specified period on a particular pin. You'll want to filter the output with an RC network to filter the high-frequency noise generated. Send the frequency in hertz (two bytes) and the duration in milliseconds (also two bytes). The PAK-IV returns 0. FREQOUT2 This command emits two tones for a specified period on a particular pin. You'll want to filter the output with an RC network to filter the high-frequency noise generated. Send the first frequency in Hertz (two bytes), the second frequency in Hertz (two bytes) and the duration in milliseconds (also two bytes). The PAK-IV returns 0. GETRAND You can use this command to read a number that is suitable for seeding a random number generator. This number is actually a free-running clock inside the PAKIV. The PAK-IV will return a zero and the quasi-random byte. HIGH Forces the specified pin to be an output and outputs a 1 on that pin. Always returns 0. INPUT Converts the pin number to an input. Always returns zero.
LOW Forces the specified pin to be an output and outputs a 0 on that pin. Always returns 0. OUTPUT Changes the specified pin to an output. Always returns 0. PULLON/PULLOFF These commands enable and disable the weak pull up resistors (about 20K) on the 8 I/O ports associated with BANK A. The default is disabled. The return value is always 0. PULSIN0, PULSIN1 Measures low and high pulses. Returns the length, 16-bits, in 2uS units. PULSOUT Pulses the output for the specified duration (a 16-bit word specifying 2uS units). PWM PWM generates a pulse width train of the specified duty cycle (a byte; 0 is 0%, 255 is 100%) for the alloted time (a 16-bit number in 1ms units). RCTIME0, RCTIME1 Measures the time for a capacitor to charge or discharge. Returns a zero and the time in 2uS units (16-bits). READ Use this command to read a byte from the PAK-IV's scratch pad RAM. Write the address (from 0 to $5F) and the return value will be a zero byte, followed by the data byte. REVERSE Changes an input pin to an output pin and vice versa. Always returns 0. SHIFTIN ShiftIn requires a single byte argument. The top four bits of this argument specify the mode. The bottom four bits is the number of bits to shift (1 to 8). The mode may be any of the following: 0 - MSBPRE (MSB first, sample before clock) 1 - LSBPRE (LSB first, sample before clock) 2 - MSBPOST (MSB first, sample after clock) 3 - LSBPOST (LSB first, sample after clock) The PAK-IV returns a 0 and the byte shifted in.
SHIFTOUT ShiftOut requires a byte argument followed by a data byte. The top four bits of this argument specify the mode. The bottom four bits is the number of bits to shift (1 to 8). The mode may be any of the following: 0 - LSBFIRST (LSB shifted out first) 1 - MSBFIRST (MSB shifted out first The PAK-IV returns a 0. TOGGLE Forces the specified pin to be an output and then reverses its state (that is makes a 1 a 0 and a 0 a 1). Always returns 0. WRITE This command writes a byte to the PAK-IV's RAM. Data stored here will remain indefinitely, even surviving power loss. Send an address byte (from 0 to $5F) and the data byte. The PAK-IV will return a 0.
Typical Circuits and Software
Connecting the PAK-IV to its external components is simple. Supply 5V to Vdd and ground the Vss pin. Connect the two outer pins of the ceramic resonator to the RES1 and RES2 pins (the order does not matter). Ground the center pin of the resonator. Connect the RESET pin to 5V. For the simplest mode of operation connect the ENABLE/BUSY pin to 5V and the BUSY/MODE pin to 5V through a pull up resistor (10K-22K). Of course, you'll also need to make connections to the host microprocessor. You may also want to make different connections to ENABLE/BUSY and BUSY/MODE if you want to use different methods of synchronizing.
Connections to Host Data Clock
5V
Both Resistors: 10 to 22K
4
SIN SOUT CLK RESET Vss
3
BUSY/MODE ENABLE/BUSY RES2 RES1 Vdd
2
Busy output (optional)
5
6
10
5V
1 7, 8, 19
Resonator
9
20
PAK-IV
Example 1. Connections to Stamp or similar host
If you are using the Basic Stamp II or Basic Stamp IISX, you'll have no problems using the ShiftIn and ShiftOut commands. Many Basic Stamp-compatible compilers have these commands too. If you don't have access to these commands, don't worry. Here is some simple code (written in simple PBasic) that shows the actions you have to take: ' B1 is the byte to shift shiftoutput: output datapin for b7=0 to 7 ' Set data pin to 0 or 1 low datapin if (b1 & $80) <> $80 then so0 high datapin so0: b1=b1*2 ' shift byte left high clkpin low clkpin ' could use pulsout next return ' B1 is byte to input byte shiftinput: input datapin b1=0 for b7=0 to 7 b1=b1*2 b1=b1 | in15 high clkpin low clkpin ' could use pulsout next return You'll find a library of Basic Stamp II routines that allow you to access the PakIV on the companion disk. Here is a simple program that generates random numbers while blinking an LED connected to the PakIV's B4 pin and scanning a button on B3:
Xpin=1 gosub XBank agn: xpin=4 ' toggle pin 4 gosub xtoggle gosub xgetnumber ' get random number & print it debug hex2 xoutvalue,cr xpin=3 ' check switch on pin 3 gosub xread if xoutvalue=1 then nobz ' if switch up, no buzz xpin=5 ' switch down: buzz on B5 speaker xA=1000 xB=500 gosub XFreqout nobz: goto agn ' do it all again
Frequently Asked Questions
Q: Can the PAK-IV work while the host does other operations? A: Of course! Just send your commands and proceed without waiting for the response code. Be sure to read the response before sending another command (unless you reset the PAK-IV). Q: Can I run the Pak IV from a different clock source? A: Yes. But it isn't a good idea because many of the commands are clock-sensitive. You'd need to adjust the timing of all time-sensitive commands to account for the change in clock speed. Note that if you are upgrading from a PAK III, you might want to use a 10MHz clock to maintain compatibility. Q: Is there a second source for the PakIV? A: No. However, if you have a high-volume application and you are concerned about availability, contact AWC about obtaining a license to produce your own Pak IV's or obtain them from third parties. We can also make SOIC and high temperature versions available as a special order item.
Basic Stamp II Library
On the enclosed disk you'll find IO2UTIL.BS2 which contains a simple library for the PAK-IV. Here are the calls in that file: Call XCount XRRead XRWrite XFreqOut XGetNumber XHigh XInput XLow XOutput XPulseIn0 XPulseIn1 XPulseOut XPWM XRCTime0 XRCTime1 XRead XReset XShiftIn XShiftOut XToggle XBank Function Count pulses Read RAM Write RAM Generate tone Get time-sensitive random number Set pin high Set pin to input Set pin low Set pin to output Read low pulse Read high pulse Generate pulse Generate PWM RCTime low RCTime high Read input Reset the coprocessor Shift data in (MSBFIRST) Shift data out (MSBFIRST) Toggle pin Switch bank Notes Time in xA, return in Xoutvalue Address in xA, return in Xoutvalue Address in xA, byte in xB Freq=xA, Duration=xB Result in Xoutvalue Pin in Xpin Pin in Xpin Pin in Xpin Pin in Xpin Pin in Xpin, result in Xoutvalue Pin in Xpin, result in Xoutvalue Pin in Xpin, duration in xA Pin in Xpin, duty cycle in xA, duration in xB Pin in Xpin, return in Xoutvalue Pin in Xpin, return in Xoutvalue Pin in Xpin, result in Xoutvalue Always call first Pin in Xpin, 8 bit result in Xoutvalue Pin in Xpin, 8 bit data in xA Pin in Xpin Xpin = 0 for A, 1 for B
Specifications
Absolute Maximum Ratings Ambient temperature under bias Storage temperature Voltage on VDD with respect to VSS Total power dissipation (1) Maximum current out of VSS pin Maximum current into VDD pin Maximum output current sunk by any I/O pin Maximum output current sourced by any I/O pin Maximum current sink/source by A0-A7 and comm pins Maximum current sourced by B0-B7 DC Characteristics Parameter Minimum Supply voltage 4.5V Vdd rise time on .05V/ms power up Supply current @20Mhz
-55C to +125C -65C to +150C -0.3 to +7.5V 1000 mW 300 mA 250 mA 25 mA 25 mA 200 mA 200 mA
Typical 5V 10mA
Maximum 5.5V 20mA


▲Up To Search▲   

 
Price & Availability of PAK-IV

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X