Date | Version | Changes |
---|---|---|
16th Jan 2002 | 0.9 | Moved Manual into new website. |
Overview
miSim DE is a Java program that
simulates a microcontroller and devices connected to it. It includes a macro assembler,
simple editor and a disassembler. miSim DE
runs on any Java 1.1 compliant platform including Windows 95, 98, 2000, ME and NT
as well as Linux and other operating systems that support Java. Currently,
miSim DE simulates the Microchip PIC16F84,
though other microncontrollers are being implemented.
The software runs as either an applet in a Java compatible broswer, or a stand-alone application. Microcontroller source code can be loaded, edited and assembled by the miSim DE macro assembler. Alternatively it can load binary (.hex) PIC® MCU files produced by other assemblers and compilers for the PIC16X84 series of 8-bit processors. Assembled code is displayed as an easy to read listing and can be run or singled stepped while registers and chip inputs and outputs are examined or changed.
The great strength of miSim DE is that it uses Java to implement a system of Plugins. Plugins can simulate real physical devices connected to the simulated processor - generating input, or responding to output as the simulator runs. The Plugin Interface is completely open so plugins can easily be written to simulate any device. A simple set of plugins are already available, including demonstration code to help develop new plugins.
The Simulator is fast too. On a 200MHz PC, running Sun's Java 1.2 VM, simulated speeds of over 20MHz can be reached. More modern machines can easily exceed the speeds that current real chips are capable of.
The Simulator is written in pure Java and will run under Java 1.1 or newer Java VMs. This makes it suitable for use on non-MS platforms - Linux, Solaris, Mac OS and others remain poorly supported for PIC MCU development tools. It requires no special hardware or software other than that needed to run Java itself, and the distribution is small - only a few hundred Kb.
Background
This project was born out of embarassment. A colleague kindly introduced me to
some friends who were looking for a Java engineer. My contract at the time was
reaching its end, so I went along to meet them in a local pub (traditional
interview territory for Cambridge). Not expecting a full interview and distracted
by my work, I didn't prepare for the meeting. When it turned into a Java test
halfway through the roast-beef sandwiches I was caught off-guard (and with a
mouthful of crusty roll). To my embarassment, and as a great disservice to my
colleage, I did not shine in the interview.
One of the technical areas we discussed was how to write 'efficient' Java programs. Of course there are some simple rules that help - don't directly manipulate Strings, don't create unnecessary Objects and so on. I didn't manage to communicate any of this to my interviewers and spent the rest of the day brooding over my poor performance.
As I was brooding, I started to think about simulators. The core problem is interpreting a machine code instruction, deciding what it means and executing a small piece of code that simulates that function. In classic procedural languages, this task is often written as a big (very big) switch statement. In Java, you could take a similar approach, but there is an interesting alternative. I won't go into the full details here (see the How it Works section for that), but I wanted to try it out and see what would happen.
I had just been reading some of the sites of people who were squeezing more out of the PIC MCU than could possibly be expected. People like Rickard Gunée were making this tiny, simple, cheap chip do tricks like generating TV signals and playing Tetris. Suddenly, I knew what I wanted to do.
Three and a half thousand lines of code later, the Simulator reached a stage where it was more than a quick fiddle. I could play Tetris (which, now I come to think about it is perhaps not that much of an achievement) and run my own PIC MCU software. It seemed like a good idea to release the program to the world in general and see what they thought.
![]() |