miSim DE and JavaQ. What do I need to run Java? A. All you need is a Java Runtime Environment (JRE) which is a set of libraries and a Java interpreter. You do not need to compile miSim DE as it has already been compiled into Java class files - which can be run with the JRE. You can download Sun's JRE for your Operating System by Clicking Here The power of Java is that anyone can develop a Java Runtime Environment for any platform and operating system - which means that you can run Java applications on Windows, Linux, Solaris, MacOS, RiscOS and many other platforms. Q. Isn't Java Slow? A. Not at all - though as with any programming language, you can write slow applications if you want to. On modern computers, with the latest versions of the Java interpreter, Java applications can run as fast as applications written in any other language. miSim DE has been written to be as efficient as possible - and can simulate devices at phenomenal speeds. Q. What about running Java on PICs? A. Java is a modern language designed to run well on high-end processors with architectures suited to object-oriented design. Whilst there are some interesting projects to run Java on smaller microprocessors, the end result is not ideal. Java applications are simply not suited to the smaller devices such as the PIC16F84, and larger microcontrollers will use huge amounts of memory just to run a tiny Java program very slowly. The most important goal when writing any language has to be to make writing software easier. A language for microcontrollers must be easy to understand, to write and to maintain. Sometimes 'squeezing' a language to fit a particular device introduces more confusion and problems than it solves - other languages have suffered enormously in being translated to microcontrollers. The best approach to 'Java on PICs' might be to write a compiled language that had Java-like syntax, but was designed specifically with real-time, compact and straightforward execution in mind. A future version of miSim might include such a language. Q. Why was miSim written in Java? It would be nice to say that Java was chosen as the best possible language for this project. However, the truth is that the simulator was originally written in Java as a technical exercise. Since then, Java has turned out to be very much the best language to support the expansion of miSim DE. Q. What makes Java so suitable? Java is designed with three core concepts that make it ideal for writing a development environment such as miSim DE. The first concept - portability - has obvious advantages. PIC developers are more likely than casual computer users to be using machines that don't run Windows. Being able to have a development environment that fits your usual way of working makes it easier to use that tool. The second concept - extensibility - affects how miSim has evolved and can be expanded. Being able to offer a very clear set of Interfaces for Plugins and for simulating new processors makes it fantastically easier to develop new components. As Java can discover new components when it runs, sharing extensions to miSim simply becomes a question of sharing a small set of files. The third concept - flexibility - means that Java comes with the ability to support a huge number of standards straight out of the box. miSim DE 2.0 can integrate with your browser, update itself through the internet and control third party programmers without any need to download special components. Q. How Do I Extend miSim DE? A. To write Plugins or other extensions to miSim you need to be able to write and compile Java. This isn't the place for an introduction to Java - there are some excellent books on the subject. However, you can download the source code for miSim DE 1.x and have a look at how it works. Some of the Plugins available for miSim were written by people who had never written Java code before! Check out the 'plugins' directory in the source code for examples of how Plugins are written. To compile Java you will also need the Java SDK from Sun - click Here to download the relevant version for your operating system. Once you have installed the SDK, you can compile a Java class with the command: javac MyClass.java
If you are writing a Plugin class that works with miSim you will
need to include the existing classes on your classpath - and might put the java source in the
plugins directory (use the (In Windows) javac -classpath "$CLASSPATH$;misimdeXXX.jar;." plugins\MyPlugin.javajavac -classpath $CLASSPATH;misimdeXXX.jar;. plugins/MyPlugin.javaThe best first step when writing a Plugin is to take an existing Plugin source file and alter it a little to behave differently. Writing a new Plugin from scratch is a much harder task.
|