Working with Stamps and PICs

copyright, Peter H. Anderson, Georgetown County, SC, Mar, '98


Many have asked me, "Should I get started with the Parallax Basic Stamps or with PICs".

There is no simple single paragraph answer. People are working at different experience levels and they have different goals and it becomes all the more complex with the availability of numerous development products. For the newcomer, getting started can be one very confusing and expensive experience.

This discussion deals with such items as the Parallax Basic Stamps 1 and 2, Versatech's TIC62, Micro Engineering Labs PIC Basic, Micromint's Pic Stic and other approaches to using the Microchip PIC in embedded processor control. The intent is to aid the newcomer to the area of embedded processor control in appreciating the strengths and weaknesses of various products and how many fit together in realizing a development environment for PIC based designs.

Note that this is a noncommercial site. My students develop educational materials and products which aid other people in tinkering and this has proven a nice platform in enhancing their education and raising their self esteem all the while helping many others beyond Morgan. The results of these efforts are this Web site, a number of books and a number of products. I can't afford to give these away and thus we do sell books and products. In the spirit of helping others, we attempt to do this inexpensively and any meager profits are used to fund new developments.

Clearly, if these sell well, I am pleased as there is a satisfaction in creating and seeing the fruits used by others. However, if they don't, my financial position in life doesn't change.

This is a good vantage point as it affords me the ability to honestly appraise products and publicly note "buy this" or "don't buy that".

Thus, in the following I have attempted to be up front and frank. We have been down many roads and spent a great deal of money. Some turned out to be dead ends, while others proved quite valuable. The intent is to provide some guidance in helping you down the right road.

The Parallax Basic Stamp 2.

Frankly, my feeling is that every enthusiast in the area of embedded processor control should have a Basic Stamp 2.

These are universally $49.00 from Jameco, Digikey and Parallax and a number of other sources throughout the world.

For those on a tight budget, or for those of us who must have many Stamps, we offer a homebrew kit consisting of the EEPROM, 20MHz ceramic resonator, MAX232 and a few discrete components for $7.00 ($5.00 for each additional). You can order the Basic Stamp 2 Interpreter IC in a 28-pin DIP from Parallax for $25 ($20 each for five).

Parallax offers a Basic Stamp 2 Starter Kit for $149. This includes the development software, a manual, a serial cable and a small carrier board. Save the money. Both the software and the manual are available from the Parallax web site, you can easily make up a serial cable and the carrier board is close to useless for the enthusiast who desires to experiment. The Basic Stamp 2 module is a 24 pin DIP and I suggest you invest in a solderless breadboard that will allow you to prototype project after project.

The manual is also available in printed form from Radio Shack for $35.00.

Parallax also offers a Basic Stamp Activity Board for $79. This consists of simply four LEDs, four pushbutton switches, a speaker, a potentiometer and two eight pin sockets to accommodate various ICs. It is very poorly documented and you are bound to be disappointed.

Here again, invest in a solderless breadboard. Al Williams at http://

offers a bread boarding system including a number of components. We also offer Starter Packages which I feel are superior. But, whether you go with Al's system, our's or go out and buy a breadboard, some LEDs and switches, you will be far ahead in prototyping your own


Why Not the Basic Stamp 1.

Electronics dealers continue to advertise the Basic Stamp 1 right along with the Basic Stamp 2 and my concern is that many hobbyists mistakenly get sidetracked toward the Basic Stamp 1. This is exacerbated by Radio Shack offering a Basic Stamp 1 package which includes the Stamp 1, software and manual.

The Basic Stamp 2 has eight times the memory, twice the I/O, a far more powerful instruction set and a far more powerful development software package. My students were forever running out of program memory on anything but the most simple of programs.

For example, I had two students who attempted to interface a Stamp 1 directly with an LCD and display my name and amateur call sign. This is not a complex program and yet it required a great deal of time and effort for them to cram the program into the 256 bytes available on the Stamp 1 and there was no remaining programming memory to do anything else.

There is no doubt that in many applications, the Basic Stamp 1 will do the job. However, if you are an enthusiast intending to tinker with many projects, avoid the aggravation and go with the Basic Stamp 2.

Parallax has one clever feature associated with the Basic Stamp 1. Once you have your program working, you can very simply burn the program into a PIC16C57 for production. However, this requires that you have a $199 Parallax PIC programmer and there are far less expensive and more robust programmers which are discussed below. This may have been clever at one time, but with the advent of the PIC16F84 which may be erased and reprogrammed again and again, in my mind this ceases to be a strong selling point.

Why the Basic Stamp 2 is Important to Developers.

My initial statement was the thought that every embedded processor control enthusiast would benefit from having one or two Basic Stamps for use in the development of projects.

Consider an example.

We are currently developing an inexpensive PIC based weather kit capable of measuring two temperatures, barometric pressure and relative humidity. This will have a two serial interfaces, one for interfacing with a PC or Stamp and another for local display on our PIC-n-LCD serial LCD.

The nature of the Stamp is such that one can quickly develop, debug and test such modules as interfacing the pressure sensor with a 12-bit A/D converter and interfacing a capacitor that changes as a function of humidity with a 555 free running clock. All of this involves calculations which may be quickly programmed using the Stamp.

Barometric pressure is a function of absolute pressure, altitude and temperature and thus some means must be provided to permit the user to enter site dependent data. And, the list goes on and on.

When developing an interface with an LTC1298, it may not initially work for a number of reasons. Either we do not thoroughly understand the serial protocol and we write good code for the incorrect protocol or we do understand the protocol but write incorrect code for the right protocol or both. With the understandable nature of Basic it is less likely one will write incorrect code or overlook an error for very long. The nice thing about the Stamp is the ability to quickly make changes and try them and with a bit of knowledgeable trial and error get the interface working. In a few hours with a Stamp, one can get more done than in days of frustration with a Stamp.

The project involves providing the user with a menu to enter options and calibrations. What looks good on paper isn't always good in real life and here again the ease of the SEROUT and SERIN Stamp commands along with the ability to quickly change the design allows us to relatively quickly develop a prototype interface.

In summary, the Stamp allows us to quickly prototype the design. We then have better understand all of the tasks, we understand the hardware interfaces and having a working prototype gives us a bit of courage in mapping the design over to a PIC.

In our case, the goal is low priced kits for the experimenter and in the effort we will probably provide both a kit of parts along with free source code for the Stamp enthusiasts and a programmed PIC along with parts for others.

The significant points are that if you are a hobbyist who is simply tinkering and learning or a professional who sells products, the Stamp is a viable platform for both the development and the actual product.

And, if you are a professional developing PIC based products for sale, the Stamp will speed the development process. Get aspects of the design going on the Stamp and then port them over to a PIC.

Summary thus Far.

The Parallax Basic Stamp 2 is an excellent platform for newcomers and hobbyists and a very powerful tool in the development of products which may either be implemented using the Stamp itself or mapped over to a Microchip PIC, or for that matter to a 68HC11, 8051 or ATMEL flash processor.

Your investment need be no more than the $49 for the Basic Stamp 2 or even less with our "homebrew" approach.

Take a pass on the Parallax Basic Stamp 1, the Parallax Starter Packages and the Parallax Basic Stamp Activity Board. Invest in a solderless breadboard and a stock of common components.

Why is Tinkering so Easy with the Stamp 2.

First, the user writes the program in Basic. I love assembly and actually dislike Basic, but there is no escaping the fact that one can program far more quickly in Basic.

After editing your Basic Program on a PC and correcting all of the syntactical errors, the PC development software generates "tokens" which are downloaded to the PIC associated with the Basic Stamp and saved in the associated 24LC16 EEPROM. Once downloaded, the Stamp's PIC fetches each of these tokens in turn, decodes them and carries out the desired action.

Thus, the function of the PIC associated with the Stamp is one of communicating with the PC, saving tokens to EEPROM and fetching the tokens, decoding them and carrying out the specified action.

By using this approach, there is no special PIC programmer. In fact, the PIC has already been programmed by Parallax and your program is saved in the peripheral 24LC16 EEPROM.

Thus, in development, there is not the usual two step process of inserting your processor in a special programmer, programming it, taking it out and placing it in your circuit.

Rather, from within the PC development software, it is a one step process of alt-R (run), observe the result, change the program, alt-R and again observe. Aside from hitting the keyboard nothing else is required.

What are the Disadvantages in the Approach.

The obvious disadvantage in fielding a Stamp 2 in a design is the $49.00 cost.

However, it will cost a company a great deal in the development time associated with mapping the design over to a PIC. Thus, in limited run systems, each costing many thousands of dollars, the $49 may not be a factor. Most of my consulting activities have been very low run systems and by fielding them using the Stamp, I have the capability to provide revised code and have the customer load the revision.

I know of no way to "protect" my code. That is, the customer may well read the EEPROM and copy it for other systems. However, in consulting, I am paid well for the development, the customers are honest and the systems are so specialized that no one would really want to copy the code.

The biggest deficiency in using the Stamp is speed. In executing a command, the Stamp must fetch the tokens from the EEPROM which may require hundreds of instruction cycles.

However, this has impacted me only when interfacing with the Dallas 1-Wire devices where a logic zero must be followed by a read within 15 usecs. The best I can do with a Stamp is 100 usecs.

Many will complain of the 2048 token capacity. My general feeling is that if I have a design which I can't prototype on the Stamp 2, I probably won't be able to write the assembly language code to get it into a PIC16C558 which provides 2048 bytes of program memory and 128 RAM variables.

I assume there are valid applications where the 2048 token limitation is a barrier. One might then consider storing text strings in outboard EEPROM and using additional outboard Stamps or PICs to perform certain tasks. The other alternative is to go with a Micromint Domino which is an 8052 based processor. (Aside from that I don't know much about the Domino).

Other limitations of the Stamp 2 is the lack of interrupts and lack of a real time clock / counter.

A Better "Stamp" - The Versatech TICkit 62.

Another processor which uses the tokens stored in EEPROM approach and thus provides the same ease of trial and error is the TICkit 62 developed by Versatech at The price is marginally less than a Stamp 2 ($45). However, here again, you can "roll your own" for about half the price.

Unlike the Parallax $149 cost for the development package, the Versatech development kit is a more realistic $45 and it is very well done.

I have not personally used the TICkit 62. However, one of my undergraduate students spent a semester fooling with it and he developed a good many sample applications which appear on various pages on this web site . The student's previous more experience than a few weeks with a Basic Stamp 1 and no experience with a Microchip PIC.

In perusing the various manuals I liked the language which might be termed a combination of Basic, Pascal and C. However, for those who are currently using the Basic Stamp 2, there is a learning curve. The language is quite different.

A number of the limitations associated with the Basic Stamp 2 are solved with the TICkit 62. The number of tokens is limited to 8192 (four times the Basic Stamp 2) and both interrupt capability and a real time clock counter are provided.

The TICkit 62 itself uses a Microchip PIC16C62 which is far more powerful PIC than that used on the Basic Stamp 2. The Stamp 2 uses a PIC16C58 which uses 12-bit instructions with a stack which is limited to a depth of two. The PIC16C62 uses 14-bit instructions with a stack that can accommodate a depth of eight.

However, like the Basic Stamp, the TIC62 fetches tokens from EEPROM which requires hundreds of instruction cycles. It is faster than the Basic Stamp 2, but not fast enough to directly interface with the Dallas 1-Wire devices.

In my mind, the Versatech package is a vast improvement over the Parallax Basic Stamp 2.

However, for the moment, we have abandoned the Versatech effort as our goal is to develop material to encourage tinkering and most hobbyists are attracted to the Basic Stamp. There just didn't seem to be much point in developing material for the Versatech which is read by two percent as compared with the numbers reading material related to the Basic Stamp.

The Basic Stamp 2 is well supported by the community of enthusiasts. Both Parallax and High Tech Horizons ( have vast libraries of applications using the Basic Stamp. High Tech maintains a List of Stamp Applications (LOSA) and Parallax maintains a list server which is very active. A newcomer can send a message asking virtually any question and with a few hours will have some ten messages from people who do really know the Stamp.

There is no comparable support for the TICkit 62. However, I have found that Glenn at Versatech, the developer of the TICkit 62 is very good in responding to e-mail

Thus, if you are a newcomer, I suggest the Parallax Basic Stamp 2. It's a bit like the IBM PC and the Mac of many years ago. You may disagree, but there isn't much question in my mind that the Mac was the superior machine. But, everyone jumped on the IBM wagon and thus software developers concentrated on the IBM PC. The Mac was superior, but the support made the IBM the standard. Similarly, in my mind, the Versatech TIC is superior, but the Parallax Basic Stamp is the standard.

However, if you have a good amount of experience and do not need a great deal of support and can use the superior features of the TICkit 62 or are just looking for something new to tinker with, the Versatech "Stamp" may be a viable alternative.

Another Summary.

Both the Basic Stamp 2 and the Versatech TICkit 62 are similar in concept in generating tokens and saving these in EEPROM. The result is a one-step process of download code, observe, modify code and try again. Both make for a development platform that enables fast reworks of code.

The Basic Stamp 2's major deficiencies are a 2K token capability, lack of interrupts and lack of a real time clock and counter. The Versatech TICkit 62 provides far more program memory and does provide for interrupt handling and a real time clock and counter. Neither is fast enough to interface directly with the Dallas 1-Wire family.

Although the Versatech is a better processor, the Basic Stamp is far better supported and I would suggest the Basic Stamp 2 to newcomers who need that support.

ME Labs - PicBasic Compilers

With the Basic Stamp 2 and the Versatech TICkit 62, tokens are saved in an outboard EEPROM. The PIC then fetches these tokens, interprets them and executes the necessary tasks to perform the specified function.

The approach taken by Micro Engineering Labs with their PicBasic Compilers is to skip the tokens. Currently, ME Labs has their original PicBasic and a new PicBasic Pro Complier at $149 and $249 respectively. In addition, you will need a PIC programmer. The is treated in greater detail later in the discussion.

The developer uses the MELabs PicBasic Compiler to edit a program on a PC. This Basic (.bas) file is then complied which generates an assembly language (.asm) file. The (.asm) file is then assembled generating a (.hex) file which is then used to program a PIC.

Thus, the development cycle is one of writing the Basic code and after removing the syntactical errors, assemble the resulting .asm file. Then program the PIC. Remove the PIC from the programmer, place it in your circuit and observe the results.

Note the extra step of programming the PIC, removing the PIC and placing it in your circuit. This is somewhat more cumbersome than working with the Stamp where changes can be made quickly and directly downloaded without transferring the PIC to a programmer and back to your circuit. However, in noting that it is more cumbersome, this is not to be construed as meaning it is any too difficult.


There are many advantages in this approach.

Currently a Microchip PIC16F84 which may be electronically erased and reprogrammed thousands of times is nominally $5.50. Add a three terminal ceramic resonator $0.75 and you have a system. Thus, for less than $7.00 you have a system which may be used for development and the same system may then be used as your final product.

In addition, the compiler supports most if not all of the Microchip 14-bit core devices which have an 8-level stack. This includes the new 12C671 and 672 in an 8-pin package along with 16C554, 556, 558, 61, 62, 62A, 620, 621, 622, 63, 64, 65, 65A, 71, 710, 711, 715, 72, 73, 73A, 74, 74A, C84, F83, F84, 923, 924.

Currently, only the 16C84 and the 16F84 are electronically erasable and re-programmable. Thus, you may initiate your development or develop small portions with one of these PICs and then change the target processor to accommodate your needs in the final product. To my knowledge all of the above are available in a ceramic DIP which may be programmed and then erased using high intensity ultraviolet radiation. Your ultimate design might then use a one time programmable (OTP) version.

Typically, a windowed EPROM version is $12 to $20 and a one time programmable version is $2 to $7, depending on the actual device.

One may wonder why move from a 16F84 if the savings is only a dollar or two. You may not wish to if the 16F84 will do the job. However, each of the above listed devices has its own strengths; e.g., an 8-pin DIP with an internal clock, more program memory, more RAM, on-board analog circuitry, on-board A/D converters. The point is that with the Parallax Basic Stamp, your are confined to the capabilities of the Stamp. With the ME Labs approach, you are not confined to the capabilities of one PIC; you can use any in the Microchip 14-bit core series.

The ME Labs packages permit you to mix assembly with the Basic, either as a single line or entire blocks. Thus, in your development, your "main" routine might be in Basic, with various functions written in either Basic or assembly.

Once again, I enjoy assembly. However, I do not enjoy writing routines to perform such calculations as;

2905 * X / 19 + 219

And then convert the result to binary coded decimal for display on an LCD or PC.

The ME Labs approach permits such mundane tasks to be programmed in Basic.

Of course, the ability to use assembly is necessary in tapping the features of many of the Microchip PICs. For example, there is no Basic instruction to use the on board A/D converters associated with the PIC16C71.

In addition to the ability to interweave assembly with Basic, the package provides the PEEK and POKE commands.

All of this permits you to tap the full capabilities of the Microchip product line. Unlike the Stamp, you have access to the interrupts, on-board counters and the watch dog timer.

As the ME Labs approach does not use tokens which must be fetched from EEPROM, the timing issues associated with interfacing with the Dallas 1-Wire family are solved. Your program will run as fast as the PIC.


The costs of the older PicBasic and the newer PicBasic Pro are $149 and $249, respectively and in the following discussion, I strongly recommend going with the higher priced version.

A programmer is also required. This is discussed in greater detail below, but programmers vary in price from ITUTech's $39 kit to MicroChip's PIC-Start Plus for $199 and I can recommend both. Avoid the Parallax programmer as it is expensive and requires a host of expensive adaptors if you plan on using many different PICs.

The development process requires that you move a PIC from your circuit to the programmer and put the programmed PIC back in your circuit which is a bit more cumbersome than with the Parallax Stamp 2.

For a newcomer, the Stamp is about as simple and foolproof as one can get and the ME Labs approach is a bit more intimidating. I would recommend that a newcomer start with the Basic Stamp and then as the confidence and the knowledge base rises, perhaps move on to the ME Labs approach.

But, even for the experienced, I still recommend the Basic Stamp 2 as a valuable tool in quickly trying out a new idea. If you place any value on your time, the $49 for a Basic Stamp will quickly pay it's way.

Thus, when people ask me, "Stamp or ME Labs", you can see that the answer is complex. If forced to put it in a few words, buy the Stamp 2 and depending on your goals and experience level, consider the ME Labs package.

ME Labs PicBasic vs PicBasic Pro.

We purchased the original ME Labs PicBasic which is billed as being compatible with the Basic Stamp 1. That is, you can use a Basic Stamp 1, which I don't really recommend, for the

development process, and then use this same code with the ME Labs package to compile to a .asm file and then assemble to a .hex file and program a PIC.

As noted above, Parallax provides this capability for the Basic Stamp 1. Develop your code and get it working and then burn your PIC. However, this requires that you purchase the Parallax programmer at $199 and you are restricted to the older Microchip PIC16C5 series.

For that $199, you will be far ahead purchasing the ME Labs Pic Basic package for $149 and either the ME Labs EPIC programmer or the ITUTech $39 programmer in kit form.

The ME Labs approach does exactly the same thing for less money, but you are not locked into the older 16C5X family. Rather, you can tap into all of the 14-bit Microchip devices including the electronically erasable PIC16F84, interweave assembly in your code and use such features as interrupts, on-board counters and analog to digital converters and the watch dog timer.

However, we purchased the ME Labs package to aid in our development using assembly language. More to the point, I had to perform yet another calculation involving two byte multiplication and division and converting the result to BCD, a task that can take a day in assembly.

I was certainly impressed with this older package, but I was disappointed to find that the package generated an assembly language file which was not compatible with Microchip's MPLAB integrated development package. Microchip MPLAB is treated in greater detail below.

After pouting over this for a few days, I happened to point my browser to ME Labs, only to find they had a new package; PicBasic Pro.

In this package, ME Labs added many new Basic instructions with the goal of approaching compatibility with the Basic Stamp 2's instruction set.

However, more importantly to me, they provided an option of compiling so as to be compatible with the ME Labs assembler or to be compatible with the MicroChip MPLAB package.

The Microchip MPLAB package is free and I have to say that Microchip does an outstanding job of supporting their product line. MPLAB permits the developer to edit, assemble and simulate all in one powerful package.

Thus, in developing the PRO package, ME Labs has created a bridge from the Stamp to the PIC. The developer can develop small modules using the Stamp 2 and thus take advantage of the ease of quickly testing ideas. As these are developed they can be pasted into the ME Labs PRO package. The target PIC can be modified and user assembly routines can be added to fully tap all of the features of the PIC and the result can then be compiled to an assembly file which is compatible with Microchip's powerful (and free) MPLAB package.

Summary thus Far.

Basic Stamp 2 at $49, yes. Other Parallax tools; Parallax Starter Package ($149), Basic Stamp Activity Board ($79), Parallax Programmer ($199) are all no. Total thus far is $49 plus the cost of a solderless breadboard.

If you are a newcomer, you might consider moving on to also using the ME Labs PicBasic PRO package ($249). You will also need a programmer. More on this later. But, your investment in the Basic Stamp 2 is not lost money. It remains a valuable tool in the development process.

If you do go with the ME Labs packages, I strongly suggest the more expensive Pro package with the enhanced Basic instruction set, but most importantly, the ability to generate assembly compatible with the free and powerful Microchip MPLAB package.

Sidebar - The Micromint PicStic.

Micromint ( is associated with Steve Ciria's Circuit Cellar INK and I certainly have the most profound respect for Steve.

However, I was disappointed with the PicStic which is advertised as a Basic Stamp 1, plus a bit more. There are a number of different models starting at $29. A $200 development package is also required.

The PicStic itself is nothing more than a PIC16C84, a 4.0 MHz ceramic resonator and a power regulator mounted on a single inline package (SIP) similar to the Basic Stamp 1.

The development package appears to be the original ME Labs PicBasic Compiler along with ME Lab's EPIC programmer which has been modified to accept the PicStic with its SIP pinout.

Note that you can prototype your own PicStic with a more powerful PIC16F84 and a 4.0 MHz ceramic resonator for less than $7.00, about one quarter of the price of the PicStic. (The PIC16F84 is somewhat more powerful than the older 16C84 in that it provides an additional 32 RAM locations).

My suggestion is, avoid the PicStic. Buy a handful of 16F84s and ceramic resonators and buy the more powerful ME Labs PicBasic PRO package along with a conventional programmer.


There are all manner of programmers ranging from "do-it-yourself" designs, to kits costing $39, to the Microchip PicStart Plus costing $199. This is an area where I am weak as there are so many different programmers and as we have settled on the PicStart Plus as our workhorse, there has been no urgency to continually examine new approaches. However, I will offer what little experience we have had.

ITUTech. (

The first programmer we purchased was a $39 kit by ITUTech and it was very well done. A student had assembled the kit within about an hour and had successfully downloaded and programmed a PIC. The unit is supplied with a wall power supply.

DOS software is provided to download a .hex file to the programmer via a PC parallel port.

Over the course of a development, you may move the PIC from your circuit to the programmer and back to your circuit dozens of times and sooner or later one of those terminals on the PIC is going to bend and eventually break. Thus, one modification we made was to replace the conventional socket where the PIC to be programmed is placed with a zero insertion force (ZIF) socket. We also use an 18 terminal wire-wrap socket as a carrier for the PIC.

For a full listing of the PICs which may be programmed using this design, please see ITUTech's home page at

Micro Engineering Labs. (

ME Labs markets an assembled programmer know as the EPIC and this is quite often offered in a specially priced "bundle" with the PicBasic Compilers.

As with the ITU programmer, a wall power supply is provided and the PIC is programmed by downloading the .hex file via the PC's parallel port. This software is provided.

For a full listing of the PICs which may be programmed see

Microchip PicStart Plus. (

This is available for Digikey for $199.00. The package includes a 40 pin ZIF socket, wall type power supply, serial cable and it is packaged in a plastic housing. The latter is an important consideration for me in academia where what can go wrong usually does.

This unit has become our workhorse for a number of reasons.

Microchip's free MPLAB development package permits editing, assembling and simulating a program all from within a powerful integrated development environment. MPLAB also provides for seamless integration with the PicStart Plus programmer. Thus, once the user desires to program a PIC, they simply pull down a menu to program the PIC. Thus, one factor is a matter of convenience.

However the strongest factor is the versatility. As noted above, Microchip is very serious about selling PICs and in my mind they do an outstanding job in supporting developers. I believe that the PicStart Plus will program every PIC that Microchip markets in a DIP package and it is certainly in Microchip's interest to continue with this by offering free software upgrades as they have done in the past.

Thus, I strongly recommend the PicStart Plus to enthusiasts who plan on using many different PICs and want to take advantage of Microchip's ever growing product line.

Assembly Language Programming.

Thus far the discussion has focused on the Parallax Basic Stamp 2 and the use of the ME Labs Basic Compilers. If you are planning on only using the Stamp, there is no need to learn assembly.

However, if you move on to the ME Labs Compiler approach where assembly may be intermixed with Basic, it is probably to your advantage to learn assembly. A knowledge of assembly is required to use features in PICs which are not supported with Basic commands, writing interrupt service routines, reducing the amount of code and in debugging the code in the MPLAB integrated development environment.

Microchip vs Parallax Mnemonics.

As noted above, the ME Labs packages include their own assembler which is different from Microchip's free assembler. The ME Labs assembler and the assembler associated with the

Parallax programmer use what is known as Parallax mnemonics. Note that these are different than the Microchip mnemonics.

Although they both do the same things, my suggestion is that you learn the Microchip mnemonics for a number of reasons.

Microchip manufactures the PICs and of course, they are not going to cater to those who use someone else's mnemonics. Microchip maintains a vast collection of applications notes on their Web site and is very generous in distributing free documentation, both in printed form and on CDs and again, all sample code uses Microchip mnemonics.

As you surf the web, you will find that most examples of PIC programs use the Microchip instructions.

The Microchip assembler is free. It uses Microchip mnemonics and to my knowledge is not compatible with the Parallax mnemonics.

Learning Assembly.

There is no question but that learning assembly is not trivial.

It certainly helps if you have learned assembly for another processor. Prior to the Spring, '98 semester, I had taught my undergraduate students the Motorola 68HC11. In transitioning to the PIC, I have found that I can pretty much go through the entire PIC instruction set within a few hours and they can begin writing in PIC assembly. Of course, this doesn't cover all of the little subtleties and such items as interrupts and using the real time clock and counter.

The best advice I can give someone who wants to learn PIC assembly on their own is to resolve to do so and set daily goals. Goals might be to develop programs to turn on an LED, flash an LED, flash LEDs at different rates determined by an input switch.

On my home page, I have attempted to offer many routines and discussions which progress for the very simple flashing of LEDs, reading inputs, controlling a stepping motor, arithmetic

routines, looping, serial output and input, implementing compare operators, generating a random number and implementing the branch and lookup commands. More advanced topics include handling interrupts, and interfacing with devices using the Dallas 1-Wire and the Philips 2-wire protocols. I am hopeful that these may be of some help.

The best book I have seen for a newcomer is "Easy PICn" by Square 1 Electronics. This is available from Jameco and numerous other sources. My initial impression was that the material was a bit too simple, but what is simple for one person is just right for another.

Note that all that is required for assembly language programming is the MPLAB software package which is available for free from the Microchip home page and a PIC programmer, and of course some PIC16F84 and 4.0 MHz ceramic resonators.

Putting it All Together.

This far we have a $49 Stamp which permits rapid and painless experimentation.

If you wish to go further, we have the ME Labs PicBasic Pro at $250 and a programmer which can range in price from $39 to $199.

The assembly comes free. The Microchip MPLAB package is free and you already have the programmer.

If you know assembly, you really have the power to create, particularly when coupled with the power of the ME Labs PicBasic Pro.

An LCD as an Aid in Debugging.

In beginning your assembly efforts, I am hopeful you can successfully do such things as indefinitely flash an LED or flash it 10 times. Keep trying as once you do, it will give you a great deal of confidence to continue.

However, there will come a time when you program the PIC to do a task and it doesn't work. I have a great deal of trouble convincing many of my students that sooner or later they are going to have to develop a debugging strategy. They seem to tune me out as this appears yet another layer of complexity I am dumping on them. I guess they assume that they will always write perfect code and will never need this additional complexity.

I think one big reason they tune me out is that there is no one correct way to debug. Much of engineering education remains "plug and crank", that is, plug it into the equations and crank out the result. There is one way to do a problem, and this is the right way and that one right way gets the "A" grade. Regrettably, life and engineering isn't anything like this. And, debugging is "real life".

Debugging requires a good deal of thought and creativity.

Microchip's MPLAB package includes a simulator which permits the developer to single step through code, set break points and watch variables. Of course, it has limitations, but it is invaluable in debugging small modules.

I have also found that a serial LCD is invaluable in the debugging process and we sell an inexpensive unit that may be interfaced with a PIC under development using a single output for sending serial data to the LCD. Many others sell serial LCDs as well, but we offer it for hobbyists on a budget. Our assembled PIC-n-LCD 20X4 LCD is $54. Parallax has similar units for twice that.

We have also developed a number of subroutines suitable for use with a 16F84 which the user may call to aid in the debugging process. For example, a call to LCD_DEBUG will cause the LCD to display the content of the W register and state of the Zero and Carry bits in the Status Register and to display the content of RAM locations $10 through $17.

The module, currently named LCD_V45.ASM contains many other functions to provide delays, to display the content of the W register as either a character or a two digit hexadecimal value and to display a 16-bit natural binary quantity. in decimal format.

This software is available for free on this web site. The developer may include this module in their code using the #include directive. In it's current form, it is intended for use with a PIC16F84 and it uses RAM locations $40-$4F and program memory locations $300 - $3FF or about one quarter of the 16F84 processor. However, the code may be easily modified for other processors having more RAM and program memory.

Aside from debugging, a serial LCD might well be a part of the final project or product as a means of displaying data to the user.

I am currently teaching some 35 eager undergraduate students assembly language programming in the PIC environment. I push my students pretty hard with a weekly hand's on laboratory design project with weekly demonstrations and interviews. In making the change from the Motorola MC68HC11, I was quite concerned as I do not have a sufficient number of emulators to support this number of students.

We are now at mid semester and I am pleased to note that the simulator associated with the MPLAB package and the use of the serial LCD appears to be adequate in writing and debugging meaningful programs.


In developing assembly language programs there is no substitute for good detective work in debugging routines. The simulator associated with Microchip's MPLAB along with a serial LCD are both valuable tools. There are many serial LCD modules on the market. We offer both an assembled PIC-n-LCD 20X4 intelligent serial LCD module for $54 which I believe is among the best and yet by far the least expensive. We also have a $10 kit using a processor of our own design which includes everything other than the LCD.


If you spend any appreciable time writing assembly language code, consider an emulator.

An emulator is a box that interfaces with your PC and emulates the operation of your target processor. That is, a ribbon cable with a DIP plug interfaces with your external circuitry and behaves precisely the same as your final programmed PIC.

However, the emulator permits you to single step through your code, set break points, observe and modify the content of the special function registers and user assigned variables.

Once you have used an emulator, you will wonder how you ever lived without it and this was my concern in offering my current undergraduate course without emulators. The truth is that you can live without one, but an emulator makes life a whole lot less frustrating and speeds your development process.

Our total experience with emulators has been confined to the RF Solutions ( ICE-PIC series.

These consist of a main module ($499) which includes the enclosure, a wall transformer power supply, and a mother board. These are customized emulate the desired PIC with personality module which plugs into the mother board. These are typically $299. Thus, an emulator for the 16F84 is nominally $800. However, if you later decide to tinker with the PIC16C71 series with onboard analog to digital converters and a good deal more, your additional cost is limited to the cost of the personality module.

Our experience has been limited to the RF Solutions ICE-PIC as it was the first we one we purchased and within the hour an undergraduate student had installed the software, written and assembled a simple program to flash an LED and the LED was indeed flashing under the control of the emulator.

As noted several times above, Microchip does an outstanding job of supporting their PIC product line and Microchip has adopted the RF Solutions ICE-PIC as their standard which aids in insuring compatibility with the Microchip product line and MPLAB.

As noted above, the free Microchip MPLAB package provides an integrated development environment that permits the developer to edit, assemble, simulate and interface with the PIC-Start Plus to program the PIC.

The RF Solutions ICE-PIC software is a separate package and it is free from the RF Solutions homepage. However, it looks pretty much the same as the MPLAB software. Of course, the two

packages have different functions; MPLAB permits simulation and interfacing with the PIC-Start programmer while the ICE-PIC provides the tools to download to the ICE-PIC emulator, single step, set break points and watch variables. However, the editing and assembly functions may be performed in either package and one can move between the two. That is, code which is edited and assembled using MPLAB may later be brought up in the ICE-PIC package for emulation and once the developer is satisfied they have a working product, the same code may then be brought up in MPLAB so as to program the PIC.

Of course, Microchip and RF Solutions are two different companies and sometimes communication within a single company is difficult enough. However, over the year that we have been using the ICE- PIC emulators, Microchip has revised their MPLAB software a number of times and they have introduced a number of new devices. I have been pleased to note that RF Solutions has always revised their ICE- PIC software such that the two packages are compatible.

Of course, nothing is guaranteed. But, for now, we have the Microchip company that appreciates that market penetration demands that they support developers and they appear to have a strong partnership with another company and for the moment, it is working very well.

There are other emulators and they are similar in cost. However, I have been pleased with the performance of the ICE-PICs and consider the safest path to be one of staying close to Microchip.

Note that a different personality module is not required for each and every Microchip PIC and we have done quite well with three; one for the PIC16C5X series which we use for the 12C508 and 509, one for the PIC16C84 (and PIC16F84) and one for the PIC16C71.

RF Solutions also has a product line which they refer to as ICE- PIC Jr which are somewhat less expensive. These appear to be stripped down ICE-PICs, i.e., no enclosure and no wall

transformer. I suspect that they also use the ICE-PIC software and work as well as the more expensive ICE-PIC. However, I have not verified this.

The ICE-PIC series is available from Digikey. Both the ICE-PIC and ICE-PIC Jr series are available from ITUTech, and as I recall, ITU Tech is somewhat less expensive.


Hopefully, your head is not spinning.

I consider the Parallax Basic Stamp 2 to be an excellent platform for the newcomer and a valuable tool for the more advanced PIC programmer. If the Stamp meets your needs, stop there. Avoid the expensive Parallax Starter Package and Activity Board. Invest in a solderless breadboard.

If you decide to move toward PICs, the ME Labs PIC Basic Pro package is a natural bridge from Basic to assembly language. I strongly recommend the Pro package as it is compatible with the powerful and free Microchip MPLAB package.

Working directly with PICs will require a PIC programmer. I would stay away from the expensive Parallax programmer as numerous costly add ons are required as you move from one PIC to another. We have had good experiences with both the ITUTech $39 programmer and ME Labs' EPIC programmer. To assure maximum compatibility with the Microchip product line, consider Microchip's PIC-Start Plus.

If you decide to learn assembly, learn Microchip's mnemonics. This will enable you to tap the vast amount of information available in both printed form and material on the web. It will also permit you to use Microchip's powerful and free MPLAB package.

In learning assembly and in undertaking simple projects, you need only the free MPLAB package and a programmer. In addition to the simulator associated with the MPLAB package, I have found a serial LCD to be a valuable tool.

If you decide to go further, consider an emulator to speed the development process.

Consider the RF Solutions ICE-PIC series. My experience has been very very positive, they work well and the seamless integration with the MPLAB package make using them an absolute joy.

Please note that these are simply my thoughts. However, they are based on a good deal of experience and my goal in setting them down is to provide you with some guidance in avoiding many of the pitfalls which we encountered.

There may well be a better path and I invite you to look around. However, as with buying a used car or a rug, consider that the advice just may be influenced by financial considerations.

But I Don't Have $2000.

The entire package which I have outlined above is nominally $2000.

However, no one is twisting your arm. You can start and stop with the Basic Stamp for $49. You might later move to the ME Labs PIC Basic Pro Compiler for $250 plus the price of a

programmer. Clearly, moving to the emulator is the largest step.

My observation of electrical engineers over a period of 30 years has been that for many, it is a job and for others, it is a job and a hobby.

I can't say I fully understand the first. Many seem happy, others don't and some forty years of being unhappy in a job is a lot of unhappiness.

While the first group would never consider having a soldering iron outside the workplace, those who have managed to make their hobby their occupation, have more than one. They buy houses based on the absence of restrictive covenants against antennas, They have or desire to own their own voltmeter, function generator and oscilloscope. You get the picture.

There is a tendency by the first group to look at the other as "different" or "nerdlike" or "workaholic" and thus less happy. In fact, my observation has been that those who seize life in one area tend to do pretty much the same in all areas. They hike, camp, canoe, run for public office, read everything that comes their way and have more than one hobby. They get married and have children. The same curiosity and interest in life they show on the job are the same skills they apply to other areas of their lives.

Of course, these are sweeping generalizations. We all know of the "workaholic" who is compensating for a bad marriage and I am not talking about those situations.

The first group doesn't tend to invest in their job. I am certain that you have sat in a class where there is no chalk or perhaps no erasure and thus the professor doesn't use the board. I mean when one is making some $70,000 per year, who can afford a $1.00 erasure. This just doesn't seem like a happy person who takes satisfaction in doing a good job.

I have also observed that on the job (or job / hobby) either you find something useful to do or your employer will find something for you to do and in all probability you may not enjoy it as much.

Thus, I invite you to seize on life. Invest in yourself so as to establish peaks of excellence in what you like to do. If you don't, your employer will find something for you to do.

Sure, $2000 is a chunk of change. But, a $35,000 automobile is also a sizeable chunk of change and settling for a $15,000 car sure opens up a lot of other options.

I always find it useful to look at a per day cost. For the professor without an erasure, the $1.00 investment over some three years is about a tenth of a penny per day. A $1200 PC over three years is about $1.00 a day. A $2000 investment in embedded processor control is perhaps $1.50 a day.

Thus, $2000 is a chunk of change. But, if it is something you enjoy, build toward it. I really wouldn't wait around for prices to drop to under $100. Life is too short.

Should I Wait for the Scenix SX.

It always seems as if there is some exciting breakthrough just around the corner. By the time, one is available, which may or may not meet expectations, there is word of another. Technology is running pretty rapidly these days, and I would suggest you jump on as soon as you can.

For the past year, there has been a great deal of talk of the Stamp 3, based on the Scenix SX. I guess I have been as excited as anyone. A processor running at 50 MIPS, a very inexpensive development system, $4.00 per IC.

I have seen dates of Oct, '97, Dec, '97 and now the date is April, '98. But, the Stamp 3 is vaguely referred to as sometime in the summer.

I hope it meets all the expectations we have. However, I wouldn't wait. Life is short. If PICs are your thing, get going now.

There are currently a number of big players in the single chip computer market; Intel, Motorola and Microchip. Semiconductor manufacturing requires a large investment and any semiconductor line depends on economies of scale. Sales to hobbyists can't support a manufacturing facility.

The name of the game is to attract developers. If the developers don't design those processors into remote controls and toys and automobiles, there won't be any sales.

I am not all that familiar with Intel's support, but Motorola's support is excellent. Any educator need only write a letter for free 68HC11 boards and free documentation. Microchip is free with the documentation and their support tools, while not free, are excellent and reasonably priced. Thus, there is a big question in my mind as to whether Scenix can provide those low cost development tools to attract developers.

But, in addition, once user companies such as General Motors or Lucent tools up with a particular processor vendor, they accumulate an enormous investment. This extends far beyond development packages, programming hardware and emulators. Their engineers know the particular language, they have a fortune in debugged code and they have an obligation to continue to support products they have in the field. Unlike hobbyists, they simply are not going to force a change unless there is one very good reason to do so.

Large user companies also look for stability. Lucent Technologies doesn't have the luxury that a hobbyist has. Any decision to use Motorola, Intel or Microchip products involves an examination of whether the company will be around next year to supply the processors.

Thus, there are very big questions in my mind on the SX chip. While 50 MIPS is impressive, it isn't important if you don't need it. Is the SX chip such a leap in technology such that major users will scrap their current investment in whatever processors they are currently using. And, is Scenix stable. What amazing new PIC will Microchip have in a year?

I really hope the SX happens and it meets all of our expectations. But, I wouldn't wait. If you enjoy the area of embedded processors, get going now.

Happy Tinkering. 73.