PicStic™
Summary
FEATURES
DESCRIPTION
PicStic is a low-cost, industrially oriented controller on
a 0.85-square-inch SIP (PicStics are manufactured both with
and without pins). Including options, PicStic incorporates
digital inputs and outputs, analog inputs, real-time monitoring,
power-input regulation, and serial communication (provided
through software) in a single module. PicStic can be used
independently or networked together.
PicStic offers both compatibility and improved performance
and comes in three versions: PS1, PS2, and PS3. The PS1, PS2,
and PS3 are all pin-compatible with the Parallax BASIC Stamp
I.
The PicStic1 is a straight one-for-one programmable replacement
for the BS1. The PicStic2 has all the features of the PicStic1
plus a real-time clock/calendar that keeps time in terms of
the year, month, day of the month, day of the week, hour,
minute, and seconds. The clock always runs while the PicStic2
is powered. An optional 3-V lithium battery maintains the
clock when power is off. The battery, which is approximately
0.6" in diameter, can be mounted on the front or back
of the PicStic2.
The PicStic3 has all the features of the PicStic1 plus a
2-channel, 12-bit ADC. The compilers contain library routines
for reading the ADC and real-time clock. While PicStic is
BASIC Stamp I pin-compatible, you can program it in more than
BASIC. Unlike the customized hardware of the BASIC Stamp,
PicStic uses a generic reprogrammable PIC16F84 processor and
a customized compiler. Additional features and improvements
typically involve recompiling your program, not buying new
hardware.
The single major advantage of PicStic is that you get an
additional one (PS2) or two (PS1 and PS3) I/O lines and access
to the four PIC16F84 interrupt sources when using assembly
language (or an assembly-language call appended to PBASIC
or C). With an ADC, interrupts, and 10 I/O lines, the PS3
provides a powerful little controller for cost-conscious applications.
Using the PBASIC compiler, PicStic is 100% Stamp I compatible.
As a bonus, it's also at least 15 times faster for the same
crystal speed. It has twice the typically available program
space (see our separate comparison sheet (in "Frequent
Questions About PicStic") for more details).
ABSOLUTE MAXIMUMS
Supply Voltage (Pin 1):
|
+18.0 V
|
Digital Input Voltage:
|
0 V to +5.5 V
|
Analog Input Voltage:
|
0.5 V to +5.5 V
|
Storage Temperature:
|
25°C to +100°C
|
Lead Temperature:
|
260°C
|
Operating Temperature:
|
0°C to +70°C
|
(40°C to +85°C available by special order)
|
PIN DESCRIPTIONS
1
|
POWER
|
Unregulated power in. Accepts 718 VDC input. May be
left unconnected if 5 V is applied to the +5-V pin.
|
2
|
GND
|
System ground. On a PS3, it is the combined digital
and analog ground.
|
3
|
PA3
|
Bidirectional I/O line available on PS1 and PS3. I/O
line shared with RTC direction control on PS2. (See section
4.2 for the PA3 and PA4 I/O programming details).
|
4
|
PA4
|
Bidirectional I/O line. (See section 4.2 for the PA3
and PA4 I/O programming details).
|
5
|
+5V
|
5-V input/output. If an unregulated voltage is applied
to pin 1, then this pin is the +5-V output. The current
drawn from this pin should be limited to reduce the PicStic
regulator¹s power dissipation. If no voltage is applied
to pin 1, then a regulated voltage of 4.55.5 V should
be applied to this pin for PS1/3. PS2 requires a minimum
of 4.9 V. For a PS3, the voltage at this pin is the Vref
of the ADC.
|
6
|
*RESET
|
Reset input. A logic low applied to this pin resets
all I/O functions.
|
714
|
PB0PB7
|
General-purpose I/O pins. Each pin can sink 25 mA and
source 20 mA. Total current should not exceed 50 mA sinking
and 40 mA sourcing. PB0 is a direct interrupt input for
assembly-language programs.
|
AIN0, AIN1
|
On a PS3, the 2-channel, 12-bit ADC inputs are directly
above pins 14 and 13, respectively.
|
1.0 PicStic Overview
PicStic is a low-cost, industrially oriented controller on
a 0.85-square-inch SIP. At its core is a Microchip Technology
PIC16F84 RISC processor which includes onchip RAM, EEPROM,
and other features. Optional PicStic peripherals include an
NJU6355 real-time clock and an LTC1298 A/D converter.
1.1 PIC16F84 Processor
The PIC16F84 is a high-performance, low-cost, CMOS, fully-static
8-bit microcontroller with 1 KB x 14 EEPROM program memory
and 64 bytes of EEPROM data memory. Its high performance is
due to instructions that are all single word (14-bit wide),
which execute in single cycle (1 µs at 4-MHz clock), except
for program-branches which take two cycles (2 µs).
The PIC16F84 has 4 interrupt sources and an 8-level hardware
stack. The peripherals include an 8-bit timer/counter with
an 8-bit prescaler (effectively a 16-bit timer) and 13 bidirectional
I/O pins. The high-current drive (25 mA maximum sink, 20 mA
maximum source) of the I/O pins helps reduce external drivers
and therefore, system cost.
1.2 NJU6355 Real-time Clock
The NJU6355 series is a serial I/O real-time clock. It contains
a quartz crystal oscillator, a shift register, a voltage regulator,
a voltage detector, and an interface controller. The NJU6355
requires only four microprocessor bits for data transfer.
The microprocessor receives data anytime it is required.
The operating voltage is 2.05.5 V. Consequently, the NJU6355
counts accurate time data, even during backup. (The clock
can only be read or written to when VCC is >= 4.75 V.)
Since current consumption during backup is less than 3 µA,
backup can be done over a long period of time with a small
battery.
1.3 LTC1298 A/D Converter
The LTC1298 is a micropower, 12-bit, successive approximation
sampling A/D converter. It nominally consumes 350 µA of supply
current when sampling at 11.1 kHz. Supply current drops linearly
as the sample rate is reduced. The ADC automatically powers
down when not performing conversions, drawing only leakage
current.
The LTC1298 contains a 12-bit, switched-capacitor ADC, a
sample-and-hold, and a serial port. It has a 2-channel input
multiplexer and can convert either channel with respect to
ground or the difference between the two. The reference input
is tied to the supply pin.
2.0 PicStic Software
When it comes from the factory, the PicStic has no software
on the board itself. Code is developed using cross-development
tools running on a desktop PC and is programmed into the PicStic
for execution. There are several development environments
from which to choose.
2.1 Assembly
Any cross-assembler capable of creating code for the PIC16F84
processor can be used to write assembly language programs
for the PicStic. Microchip's assembler is available at no
cost from their BBS and Web
site. More information about the PIC instruction set and
how to connect to the Microchip BBS may be found in the Microchip
Data Book.
Other cross-assemblers are available including one from Parallax
that enhances the PIC instruction set with one more familiar
to 8051 programmers. Contact Parallax for more information.
A cross-assembler also comes with the Micromint PBASIC package.
2.2 PBASIC
Micromint's PBASIC compiler allows the use of BASIC Stamp-compatible
programs on the PicStic, but with much higher execution speed.
PBASIC also provides the capability to include custom assembly
language routines for time-critical tasks.
Contact
Micromint for more information about PBASIC.
2.3 C
The integrated C development environment gives developers
the capability to quickly produce efficient code from an easily
maintainable high-level language. The compiler includes built-in
functions to access the PIC hardware such as READ_ADC to read
a value from the ADC. Discrete I/O is handled by describing
the port characteristics in a PRAGMA. Functions such as INPUT
and OUTPUT_HIGH properly maintain the tristate registers.
Variables including structures may be directly mapped to memory
such as I/O ports to best represent the hardware structure
in C. The microcontroller clock speed may be specified in
a PRAGMA to permit built-in functions to delay for a given
number of micro- or milliseconds. Serial I/O functions allow
standard functions such as GETC and PRINTF to be used for
RS-232-like I/O. The hardware serial transceiver is used for
applicable parts when possible. For all other cases, a software
serial transceiver is generated by the compiler. The standard
C operators and the special built-in functions are optimized
to produce very efficient code for the bit and I/O functions
normally required for these microcontrollers.
Functions may be implemented inline or separate. Function
parameters are passed in reusable registers. Inline functions
with reference parameters are implemented efficiently with
no memory overhead.
During the linking process, the program structure including
the call tree is analyzed. Functions that call one another
frequently are grouped together in the same page. Calls across
pages are handled automatically by the tool transparent to
the user. RAM is allocated efficiently by using the call tree
to determine how locations can be reused.
2.4 Fuzzy Logic
Information to be included in next datasheet revision.
3.0 Programming the PicStic
The PicStic uses Microchip Technology's PIC16F84 EEPROM microcontroller
which can be reprogrammed hundreds of times. These programs
can be created by a number of sources. Assembly-language programs
can be written in Microchip's native instruction set or Parallax's
8051-like instruction set. Compilers such as C, PBASIC, or
fuzzy logic can be used as well. The single requirement of
any programming environment is that the end result is a PicStic-compatible
Intel hex file.
Programming a PicStic is done serially, involving only five
signal connections. The five signals are power (5 V), ground
(0 V), and *MCLR (which must be pulled to +12 V), and port
pins RB7 (serial data) and RB6 (serial clock).
The PicStic Development package includes a low-cost microEngineering
Epic SE programmer which is plug-compatible with PicStic and
needs no programming adapters. (Note: the Parallax BASIC Stamp
programmer cannot be used for programming PicStic.) The PicStic
can be programmed with most other PIC16F84 programmers by
making a simple five-wire DIP-to-SIP adapter. The five signals
from your programmer's 16F84 DIP programming socket are wired
to a 14-pin PicStic SIP socket as shown in the table.
Most assemblers and compilers enable you to take advantage
of a variety of 16F84 configuration options. These include
code protection, powerup timer, watchdog timer, oscillator
designation (PicStic uses the XT), and user programming of
the 64 bytes of additional EEPROM data memory. Be aware that
you may have to set these conditions on the compiler for proper
PicStic programming.
For a more involved description of the 16F84 programming
algorithm and technology, refer to the Microchip Data Book.
4.0 PicStic Hardware
We provide sample code for much of PicStic's hardware features.
It is beyond the scope of this document to provide full details
about each device. However, we have tried to include enough
information to allow the programmer to develop code in other
languages than that used for the sample code.
4.1 Serial Connections
PicStics have no specific pins for serial I/O. The compilers
allow the user to designate the physical pin locations of
serin and serout. While we recommend the use of a proper level-shifting
serial interface, PicStic also works in other BASIC Stamp
serial configurations.
4.2 PA3 and PA4
The PA3 and PA4 I/O lines are directly accessible from assembly
language and C. However, additional assembly language routines
are necessary to access these lines from PBASIC.
The following program demonstrates how to use the extra PicStic
I/O bits. PicStic1 and PicStic3 have PA3 available, while
all three PicStics have PA4 available.
PB0 controls the mode. When PB0=0, PA4 becomes an input and
PA3 becomes an output. When PB0=1, PA3 becomes an input and
PA4 becomes an output. In both cases, the output is set to
the opposite of the input. PB7 outputs a 1200-bps serial message
that indicates what is happening. Note that if you tie PA3
to PA4 with a 1-kilohm resistor, the output self toggles the
input. The toggle speed is relatively slow due to the 1200-bps
serial output routine.
Frequent Questions about PicStic
1. Is PicStic BASIC Stamp-compatible?
Using the PBASIC compiler, PicStics are 100% BASIC Stamp-compatible.
If you have an existing BS1 program, it can be compiled using
the PBASIC compiler and executed exactly as before (including
time-related functions). The only exception to this rule is
the DEBUG command. Because PicStic uses a compiler, interactive
features like debug are not compiled with the program. PicStic
is also hardware pin-compatible with the BS1. Of course, PicStic
has more memory space and additional optional features you
may want to take advantage of.
2. I need more execution speed than either the BS1 or
BS2 have.
BASIC Stamps use a BASIC interpreter which executes the BASIC
program line by line. When using PicStic's PBASIC or C compilers,
the program is converted into fast assembly-language routines
before loading onto the PIC. Compilers are inherently faster
than interpreters.
For example, the PBASIC compiler is typically at least 15
times faster than the BS1 (10.5 times faster than a BS2) with
some individual instructions which are as much as 100 times
faster. It's quite possible that using PicStic and the PBASIC
compiler could save having to go directly to assembly language
when a regular Stamp application is too slow.
3. I'm using a BS2. Is it PicStic-compatible?
The answer is yes and no. Obviously, since the BS2 has 16
I/O pins and PicStic only has 8 (or 10), they can't be physically
interchanged. Furthermore, the BS2 has some additional instructions
to the BS1, like X-10 and DTMF. PBASIC 1.1 compiler is designed
to be straight BS1-compatible with only the addition of the
PicStic clock and ADC functions.
If you went to the BS2 merely because it executes faster
and has more program space than the BS1, it's quite possible
that a PicStic, which also runs faster and has more memory,
might fit the bill more cost-effectively. Future versions
of the PBASIC compiler will include BS2-specific instructions
which can be run on PicStic along with all the normal BS1
instructions.
4. I have a Parallax BASIC Stamp development system. Can
I use it?
No. Parallax Basic Stamps are interpreted BASIC devices,
and their development system is a tokenized BASIC downloader.
PicStics use an EEPROM-programmable processor with a compiled
program. As a compiler rather than an interpreter, it requires
different development software. In addition, because we are
programming the PIC processor itself, PicStic uses an EEPROM
programmer rather than a simple serial downloader.
So, yes, you'll need a PicStic development system to use
PicStic with PBASIC. Of course, since PicStic is still 100%
BS1-compatible, one of the best ways to develop code for it
might be to continue using a regular BS1 with DEBUG and then
use PicStics for the volume OEM application.
5. Just how generic is the PicStic? Must I always use
PBASIC?
PicStic uses a PIC16F84 processor with optional ADC or RTC
hardware. Even though it is packaged with a BS1 pin-compatible
layout, it is still an EEPROM PIC, and it executes PIC assembly-language
programs. PicStic can be programmed with any PIC EEPROM programmer
capable of serial-mode programming. A variety of commercial
PIC programmers can do this.
6. How fast is the PicStic ADC?
The LTC1298 12-bit ADC on PicStic has a faster conversion
time than any program you might write to use the data from
it. As a rule of thumb, the ADC can provide 1000 samples per
second should you care to exercise it that often.
7. How much current can I draw from PicStic's onboard
regulator?
PicStic incorporates a heftier regulator than the BS1. It
is also reverse voltage protected, unlike the BS1. How much
current you can draw from it for powering external devices
is a matter of total power dissipation. At a 9-V input and
25°C operation, 100 mA of output current is typically available.
See the chart provided for more detail.
8. PicStic is BS1-compatible, yet it has two more I/O
lines. Why?
PicStic has the same eight general-purpose I/O lines as the
BS1 supported in PBASIC. Because it is an EEPROM PIC and not
a serial programmed BS1, the two programming lines are no
longer required. One of them (pin 4) is always available,
while the other (pin 3) is shared with the RTC. PBASIC 1.1
compiler directly addresses the original eight I/O lines but
not the extra two. Future versions will address these lines
directly. For now, using these two I/O lines must be done
with assembly-language code called from BASIC. The spec sheet
explains this simple procedure.
9. Does PicStic support interrupts?
Yes. Provided you are using assembly language or an assembly-language
call from PBASIC or C, you have access to the four 16F84 interrupt
sources.
PicStic Comparison Chart
|
PicStic 1
|
PicStic 2
|
PicStic 3
|
BASIC Stamp I
|
Price
|
$29
|
$39
|
$39
|
$34
|
BASIC Stamp I-compatible
|
yes
|
Reprogrammable
|
yes
|
Programming
Languages
|
PBASIC, C, assembly
|
PBASIC interpreter only
|
I/O lines
|
10
|
9
|
10
|
8
|
Extra features
|
none
|
Real-time clock
|
2-channel, 12-bit ADC
|
none
|
RAM (Variables)
|
22 bytes*
|
14 bytes
|
Max Program Length
|
150 inst*
|
80 inst
|
Clock Speed
|
4 MHz
|
Execution Speed
|
50k inst/s**
|
2k inst/s
|
Max Serial I/O
|
2400+ bps**
|
2400 bps
|
Packaging
|
14-pin SIP
|
* Maximum program length and execution
speed is determined by instruction mix. Minimum overall
speed gain is typically 15 times while individual instructions
may be 100 times faster.
** Number of variables and communication speed is presently
set for compatibility. The compiler has options for increasing
both.
|
|