Issue
101 December 1998
em
Ware Top to Bottom
Part
2: Launching the Application
As
Fred journeys into the final frontier, he launches a
PIC into Internet space using a PCM-4862. Its mission:
to control tasks according to commands received via
the web. Can this PIC boldly go where no PIC has gone
before?
As
a professional writer, hardware guy, and part-time system
hacker, I spend my time thinking about whats out
there and whats to come. More often than not,
I get firsthand slaps from present and past technology.
These
love taps land either on the butt or in the face, depending
on my ability to understand and adjust to the language
of the technology. It doesnt matter if Im
working on state-of-the-art gear or really old flight-tested
hardware.
For
instance, the Internet is hereand has been for
a long time (flight-tested indeed). It still makes money
for some of us (old airplanes still fly, too). It has
the potential to make money for our children and childrens
children (imagine the next generation of jet aircraft).
But,
whats so great about it? For the enlightened,
the Internet is close to the Almighty in terms of information
as it relates to power. Whoever owns and comprehends
the information the quickest holds the power to use
it to their advantage.
Nathan
Bedford Forrest knew this long ago. He was consumed
with fighting a war, but the stakes were the same. Remember
the "firstest with the mostest" quote? It
still holds true. With that, lets take some of
the emerging technology within reach and put some flight-tested
hardware to work.
PICing
UP
Last
month, when I laid down the groundwork, emWare supported
the 8051 microcontroller platform exclusively. Now,
theyre porting the 8051 paradigm to other platforms
like Microchips PIC.
I
dont know about you, but thats what Ive
been waiting for. With this article, youll be
the "firstest with the mostest." Ill
show you how to launch the PIC16C73 into emWare land.
And
if youre wondering why I chose the 73, welcome
to PIC16C73 101.
THE
PIC16C73 AND emWARE
Im
not going to go into finite PIC theory here. Instead,
Ill go over the points that make the PIC16C73
suitable for an emWare port.
First
of all, to control the PIC remotely, you need some sort
of communications port. Im partial to Ethernet,
but you cant plug an NE2000-compatible ISA or
PCI card into a PIC.
An
Ethernet implementation using PIC code and some Ethernet
interface hardware is one way to go, but it entails
some complexity that ruins the whole point of using
the PIC. The answer is simple.
As
I mentioned last time, emWare can communicate using
many of todays common protocols. Although Ethernet
could be used here, it looks like it isnt the
best choice. It would take a very long category-5 cable
to control the PIC once it left the Florida Room bench.
Taking
a look at the communications resources offered by the
PIC16C73, we find a synchronous serial port (SSP) that
can operate in two modesSerial Peripheral Interface
(SPI) and Inter-Integrated Circuit (I2C).
SPI
mode is a synchronous-based protocol that can operate
as a full duplex connection. Although its possible
to write any type of communications driver for emWare,
the synchronous part of SPI would present mobility problems,
as youd need the right hardware/software/ISP combination
to talk to the PIC via the Internet. SPI is primarily
used to talk to serial EEPROMs and the like.
Similarly,
I2C isnt used much off its native PC board, but
rather in an application that requires the chips to
talk. This could be a plus.
In
fact, SPI and I2C can both be used to talk to an EEPROM
device or even another microcontroller. This feature
permits logging or data forward-and-store functionality
in the emWare-laden product.
To
prove this result, the emWare 8051 demo board uses an
EEPROM to save
A/D values from a pot for later processing. Oh yeah,
the PIC16C73 has an onboard A/D module. Hmm
.
Looking
further into the PIC16C73 databook, we find that the
part is equipped with a USART (universal synchronous
asynchronous receiver transmitter). Ding! Ding!
A
quick look at emWares capabilities shows us that
emWare supports RS-232. Just leave out the "S"
in USART, and a USART smells like asynchronous RS-232
to me. The PIC16C73 also has an internal programmable
data-rate generator.
The
PIC16C73 is the right choice for first contact with
emWare. Besides all the things emWare requires, this
PIC can handle interrupts from internal peripherals,
as well as from the outside world.
The
PIC16C73 contains an abundance of I/O pins and an ample
program and data storage area. Just take a look at some
of the advertisers in this issue, and youll see
that programming the PIC is as easy as selecting a programming
product from your company of choice.