AWC

 

Using the APP2 With Linux and Java

If your computer supports Java and the Java Comm API (JCA) you can use a Java program to download hex files to the APP-II. You can use the Java program from any supported operating system, but the directions below are for Linux.

Here are the steps I took for RedHat Linux (you may have to adjust them a bit for other flavors):

bulletDownload J2SE v1.4.2 SDK for Linux RPM (self-extracting) at http://java.sun.com/j2se/1.4.2/download.html
 
bulletRun the J2SE .bin file. This generates the RPM file.
 
bulletInstall the RPM (rpm -U j2sdk-1_4_2-linux-i586.rpm).
 
bulletAdd /usr/java/j2sdk1.4.2/bin to the PATH.
 
bulletDownload Version 2.0 of the JCA for Solaris/x86 (not SPARC) from http://java.sun.com/products/javacomm
 
bulletUntar the JCA and copy comm.jar to /usr/java/j2sdk1.4.2/jre/lib/ext/comm.jar
 
bulletDownload version 2 of RXTX from http://www.rxtx.org
 
bulletUntar and run ./configure then "make install"
 
bulletGet the app2.jar file
 
bulletset CLASSPATH to something like (replace XYZ, of course):
    export CLASSPATH=/home/XYZ/app2.jar

That's it. You are ready to go. Of course, you need a HEX file generated by some Microchip programming tool (see http://www.gnupic.org/ for software). Assuming you have the APP2 connected to /dev/ttyS0 you can execute:

java com.al_williams.app2.APP2 myprog.hex /dev/ttyS0

If Java can't find the comm.jar file, you can add it to your classpath. If you do have the comm library installed properly, then you could simply execute:

java -jar app2.jar

Then you don't need to add app2.jar to your classpath at all.

Although these instructions are geared at Linux, any Java supported operating system will work as long as you install the JCA. For example, the program will work under Windows and should work on the Mac if you install the JCA (see http://homepage.mac.com/pcbeard/javax.comm.MRJ/).

Note: the RXTX libraries requires you to have access to /var/lock. If you run as root, you won't have any problems. In theory, if your user ID is in the lock group (RedHat) or uucp group (some other Linux distributions) you should be able to create files in /var/lock. You can do this by editing the /etc/group file or using the -G option of usermod. Be sure to log out and log back in for the change to take effect.

 If all else fails, try running (as root): chmod 777 /var/lock. This could be a mild security hole, of sorts, since anyone could then delete a lock file, so be sure you understand how this will affect your system.

 

 

  

 

horizontal rule

[Kits] | [Math] | [PS/2] | [Pulse In] | [Pulse Out] | [I/O] | [A/D] | [PWM] | [Position Sensing] [PIC Programming] | [RS232] | [PLD/FPGA] | [NetPorter]
[MicroTasks/Consulting] | [Components] | [Products] | [News] | [Search] | [Documents] | [Projects] | [Resources] | [Updates] | [FAQ] | [Support] [PDF Catalog]
Jump to PAKs: I, II, III, IV, V, VI, VII, VIII, IX, X, XI, XII PicoPAK: VIII

[View Cart/Checkout]

Site contents © 1997-2008 by AWC, 310 Ivy Glen, League City, TX 77573    (281) 334-4341