The Microchip SIMICE - A Poor Man's Emulator

copyright, Peter H. Anderson, Baltimore, MD, July, '98

Introduction.

The following discussion focuses on the SIMICE, a non real time emulator which was developed by RF Solutions and is a standard Microchip product.

In the discussion, I try to point out some of the limitations, but offer that this package may be well used to advantage by hobbyists as a "poor man's emulator" in developing code for such processors as the PIC16F84, 16C6 and C7 and if we ever see one, the 12C67 series.

This discussion was prompted by noting that Microchip was offering a Web Promotion of $98.88 (regularly $129.00) "through your Microchip distributor". For most PIC hobbyists, our distributor is Digikey and to my knowledge, Digikey is not carrying this product. This caused me to do a bit of a search and I offer a discussion on how you might obtain one of these packages.

I ordered one. But, to be quite honest, using the SIMICE isn't high on my list of priorities. I am now fortunate in that I have access to ICEPIC emulators and thus there is no great incentive for me to live with the shortcomings of the SIMICE. However, the price of an ICEPIC is about $800 and not everyone has this kind of discretionary money.

However, I have been on the other side without an emulator. In the Spring, '98 semester I had some 35 eager undergraduates in a course on the PIC and they did quite well with nothing more than using their heads, using the simulator associated with the Microchip MPLAB package, our serial LCD (PIC-an-LCD) and lots and lots of programming and reprogramming their PIC16F84s. In particularly stubborn problems, I pulled out the one emulator we had and usually found the problem within a few minutes.

Thus, I know what it is like to work pretty much in the blind. My concern, particularly for newcomers is that working in the blind may lead to so much frustration that they give up. This SIMICE may be an answer for some people.

MPLAB Simulator.

The MPLAB Simulator is a marvelous tool and the price is certainly right. It is free. It permits you to set break points, single step, trace into, watch variables and the like.

It suffers in that it is not real time and even a 10 msec delay may take several seconds to execute. This is easily corrected by using short delays and modifying them for the real thing.

Handling inputs is about as painless as anyone could make it, but that is still very painful. One prepares a stimulation file. Myke Predko does a good job in treating this in his book and I vividly recall the words "makes your eyes bug out" in referring to the preparation of these files.

Aside from your eyes bugging out, there is a problem in writing a stimulation file to interface with such devices as a DS1620 thermometer, 24LC65 EEPROM or LTC1298 A/D. Chances are good that you are not going to completely understand the data sheet and you are going to spend a lot of time writing an erroneous stimulation file. This is where we have found the BASIC Stamp 2 very helpful. We get a good understanding of the interfacing device using the Stamp where changes may be made in a few seconds and then we map the code over to a PIC.

SIMICE.

The SIMICE eliminates the need for the eye bugging preparation of simulation files and permits you to actually interface with the device you are using and thus solves the two major problems associated with the Simulator. You are actually interfacing with the real thing.

It consists of a unit that hangs off a PC Serial Port and communicates with the MPLAB Simulator. Thus, I assume you use it quite like you may now use the Simulator.

Frankly, I have been extremely impressed with Microchip in that they seem to really want to sell PICs and have done an outstanding job in developing and adopting quality development tools that are attractively priced and work. I was skeptical of the ICEPIC being developed by RF Solutions and MPLAB by Microchip, but the bottom line is there is a seamless integration that makes the whole thing pretty intuitive. The two companies seem to have a rather unique close interface and all the more unique in that there is a lot of land and water between the two. I assume RF Solutions and Microchip have done as good a job with the SIMICE.

The non-real-time aspect of the SIMICE of course may limit its use in some applications; serial routines and interfaces with the Dallas 1-wire devices come to mind. Just how big a penalty this is depends on your specific application. After all, many tasks are not time critical. For example, one might interface with a Dallas DS1602 elapsed time counter, Dallas DS1624 temperature sensor, Microchip 24LC65 EEPROM or Linear Technologies LTC1298 12-bit A/D. Time is not critical in any of these applications and this certainly is a lot of power for less than $100.00 and clearly, I have only scratched the surface in suggesting applications.

The Bad and Good News.

The SIMICE's capabilities are limited to the 12-bit core PICs (12C508, 509 and 16C5X series).

Of course, this is not bad news if your design target is a 12-bit core PIC. I enjoy working with students on PIC12C508 based designs, in part because they are a bit more challenging than the classic 16F84. And, the SIMICE really makes the PIC12C508/9 a bit more practical for the hobbyist. I think one could do quite well with the SIMICE, a few of the windowed EPROM devices and of course, a PIC-Start Plus programmer.

However, this 12-bit core limitation might appear a serious limitation if your final target is a PIC16F84. My point is that that the SIMICE may still prove a valuable tool in testing and debugging routines and then moving them from the 12-bit core to the PIC16F84.

One might use the SIMICE with the target being the 12-bit core PIC16C56 which appears close to the 16F84 which might be your final design target. Use the SIMICE to develop various routines to say interface with an ADC0831, LTC1298 or 24LC65 and similar, test and debug them and then move them to the PIC16F84.

The instruction set associated with the 12-bit and 14-bit core are very close. As I recall, the 12-bit core lacks a few of the immediate instructions; e.g., ADDLW .1. I encountered an interesting problem in passing values back to a calling function in the W register. For example;

	MOVF VAL, W
	RETURN

Don't expect to find the value of VAL in W on returning to the calling function. I have been told that the RETURN with the 12-bit core is in fact a RETLW 0.

The 12-bit core uses the TRIS instruction to define the data direction of I/O while the 14-bit core requires using the RP0 and RP1 bits of the STATUS register to switch banks and fiddle with the appropriate TRIS register.

None of this is any too earth shattering. Admittedly, changes will be required when moving debugged code from a 12-bit core device to a 14-bit core PIC. However, it is always the hardest the first time. Over time, I am pretty sure it becomes second nature.

One irritation with the 12-bit core is a two level stack limitation and I will confess I am inclined to resort to rather poor programming practices in avoiding subroutine calls. This can waste program space. However, if you have the space, who cares. Another approach is to use a user stack and this is discussed in a Microchip application note and there is some material on my PIC page. The user stack will port from a 12-bit to a 14-bit core device.

The most confusing aspect of the 12-bit core is switching from one page to another. However, if you use the SIMICE with the idea of developing and debugging small chunks of code, you can avoid this by confining your code to page zero.

Finally, the 12-bit core devices have no interrupt capability.

And, there may be a few more subtle differences as well.

Note that the MicroEngineering Labs PICBASIC Pro does not support the 12-bit core devices and thus cannot be used with the SIMICE.

By now, you are undoubtedly saying, "no way". But, there is nothing more frustrating then having say a PCF8574 8-bit I/O IC sitting there, not working and being able to do no more than stare at it and check and recheck your wiring. The SIMICE can open a lot of options and save a lot of frustration.

Of course, there is a penalty. There are small differences. If the user stack bothers you, resolve to limit your nesting to two and perhaps improve the quality of your code when you move it to the 14-bit core PIC.

If you find the page switching threatening, and I do, resolve to keep your code on the SIMICE on page zero.

Summary.

Certainly if your target processor is a 12-bit core device, the SIMICE is a natural for anyone who can't afford an ICEPIC emulator.

I will admit that when I first saw the SIMICE and discovered it was limited to 12-bit core PICs, I dismissed it. But, I have had some six months to think about it and over four of those months I was teaching some 35 undergraduates with no ICEPIC emulators. Looking back, I did have enough money to buy eight SIMICE systems. Had I been smarter and done so, I could have taught the 12-bit core, the use of something close to an emulator and how to move a design from one PIC to another and also avoided a lot of student and personal frustration. But, we can never go back. Rather we learn and go forward.

Indeed there is a bit of a learning curve in moving code from the SIMICE to a 14-bit core PIC. But, it sure beats staring at a non working circuit hour after hour and giving up after a day or two. I also have come to believe we learn best when we need knowledge. With the SIMICE, there is a powerful incentive to quickly learn the 12-bit core PICs and this adds to your value. This value may be a tangible benefit with your current or a future employer. But, perhaps, it is simply the personal satisfaction of knowing you accomplished something.

Availability.

When I first noted the promotion on Microchip's Web page, I was excited, but I then realized my "Microchip Distributor" and most hobbyist's distributor is Digikey and a search on their web page did not reveal that they have the SIMICE.

I did find it at Pioneer Electronics (http://www.pios.com). Look under their Industrial Electronics Div and do a search on the Microchip Part number DV162010. I assume Arrow Semiconductor (http://www.arrowsemi.com) also have it.

Unfortunately, many of these nationwide industrial suppliers (Arrow, Pioneer, Bell Milgray, etc) may not be too eager to do business with hobbyists. But, it doesn't hurt to try. Find a local Arrow and Pioneer office and give them a call.

If you are unsuccessful and really want one, send me e-mail and I will try to buy one for you. It will be $5.00 over the $98.88 web special (or $129.95 regular price) plus $4.00 shipping to you. The $5.00 covers the cost of me processing your credit card and the shipping to me. But, first try to buy it yourself as I have a monthly limit as to how much I can process on my merchant credit card account and I just about hit it each month in normal sales.