The PAK-I, II, and IX have a simple Basic Stamp library that can help you get started with these chips. You don't have to use the library -- and you'll probably want to delete the parts you don't use to save space.
Remember, the general sequence of events is:
Symbol |
Type | Devices | Description |
datap | I/O | All | Pin connected to PAK's data line (number) |
datapin | I/O | All | Pin connected to PAK's data line (inx) |
clk | I/O | All | Pin connected to PAK's clock line |
en | I/O | All | Enable line (number; not required) |
EnableBit | I/O | All | Enable line (inx; not required) |
FSaturate | Constant | All | Used to set infinity saturation option |
FRound | Constant | All | Used to set rounding on or off |
fpstatus | Variable | All | Result of many operations |
fpx | Variable | All | Input to many operations |
fpdigit | Variable | All | Result of FDigit routine |
fpxlow | Variable | All | Low part of X register |
fpxhigh | Variable | All | High part of X register |
fpxb0-fpxb3 | Variable | All | X register as bytes |
FReset | Sub | All | Reset communications (always call this first) |
FBsyWait | Sub | All | Used to wait with EnableBit (not required) |
FWaitData | Sub | All | Wait for operation to complete |
fa2d | Sub | IX | Read A/D fpx=channel; fpb=# of samples |
fa2dconf | Sub | IX | Configure A/D with value in fpx (0=normal; 1=AD3 is Vref+; 8=AD3 is Vref+, AD2 is Vref-) |
festo | Sub | IX | Store data registers in EEPROM |
fercl | Sub | IX | Recall data registers from EEPROM (automatic on power up) |
fpoly | Sub | II, IX | Perform polynomial evaluation (fpb=register, fpx=degree) |
fchs | Sub | All | Change sign of X register |
fabs | Sub | All | Absolute value of X register |
fsto | Sub | II,IX | Store X to register (register in fpx) |
frcl | Sub | II,IX | Recall X from register (register in fpx) |
fsto0 | Sub | All | Store X in register 1 |
fsto1 | Sub | All | Store X in register 2 |
frcl0 | Sub | All | Recall register 1 to X |
frcl1 | Sub | All | Recall register 2 to X |
floadx | Sub | All | Load fpxhigh/fpxlow to X register |
floady | Sub | All | Load fpyhigh/fpylow to Y register |
fzerox | Sub | All | X=0 |
fzeroy | Sub | All | Y=0 |
floadint | Sub | All | Put 16-bit integer in fpx into X as floating point number |
fint | Sub | All | Convert X register to integer and read it to fpxhigh/fpxlow (24-bit integer) and fpx (16-bits) |
freadx | Sub | All | Store X in fpxhigh/fpxlow (copy fpxlow to fpx) |
fswap | Sub | All | Swap X and Y |
fpi | Sub | All | X=pi |
fe | Sub | All | X=e (natural log base) |
fmult | Sub | All | X=X*Y |
fdiv | Sub | All | X=X/Y |
fadd | Sub | All | X=X+Y |
fsub | Sub | All | X=X-Y |
fgetdigit | Sub | All | Get a digit from X (fpx is digit #, 0 for sign) |
fdump | Sub | All | Print X on debug terminal (fpx is # of digits to left of decimal point) |
foption | Sub | All | Set options in fpx (saturate and/or round) |
fxtoy | Sub | All | Y=X |
fytox | Sub | All | X=Y |
iodir | Sub | All | Set I/O direction (0=input, 1=output); input in fpx |
iodir1 | Sub | II | Set I/O direction for 2nd port |
iowrite | Sub | All | Write to I/O port (value in fpx) |
iowrite1 | Sub | II | Write to 2nd port |
ioread | Sub | All | Reads from I/O port (returns value in fpx) |
ioread1 | Sub | II | Reads from 2nd port |
fsqrt | Sub | All | Square root of X (Newton method on PAK-I) |
flog | Sub | II,IX | Natural log |
flog10 | Sub | II,IX | Common log |
fexp | Sub | II,IX | Natural exponent |
fexp10 | Sub | II,IX | 10**X |
fpow | Sub | II,IX | X**Y |
froot | Sub | II,IX | X**1/Y (root) |
frecip | Sub | II,IX | Reciprocal |
fsquare | Sub | All | Y=X*X (does not destroy Y) |
fsin/fcos/ftan | Sub | II,IX | sine, cosine, tangent |
farcsin/farccos/farctan | Sub | II,IX | arcsine, arccosine, arctangent |
Site contents © 1997-2018 by AWC, Houston TX (281) 334-4341