Nashville, Tennessee
June 22, 2003
June 22, 2003
June 25, 2003
2153-5965
9
8.872.1 - 8.872.9
10.18260/1-2--12507
https://peer.asee.org/12507
539
Session 1159
Native Instrumentation Board Interface For Java-based Programs
Richard E. Pfile and William Lin
Purdue School of Engineering & Technology Indiana University-Purdue University at Indianapolis, Indiana
Abstract
Java is becoming a popular programming language for PC-based applications programs for many reasons. Java’s language rules force a natural structured approach to writing code, its strong data typing eliminates some of the subtitle errors encountered in C/C++ language, it’s thoroughly object oriented, it’s platform independent, and it is relatively easy to write programs with a Windows GUI using the language.
Java has a significant downside when used in data acquisition and control applications. Because Java programs run on a virtual machine and the language is strictly platform independent, there are no provisions for I/O such as that encountered when using a PC based instrumentation board. To access this type of I/O, the Java program must leave the virtual machine it runs on and run native code. A software interface can be written that will allow all of the board functionality needed to be accessed using Java calls. This paper presents the techniques to interface a Java program to native hardware using a National Instruments card as the example native hardware. The technique can be readily adapted to a variety of boards. When using the interface, student’s programs can make Java function calls to access an instrumentation card.
Introduction
Java, which has long been a popular language for web applets, is becoming more popular for stand-alone applications. Programs with graphical user interfaces (GUI) are easy to write in Java, the language is fully object-oriented and programs written in Java can run, without modifications, on different platform types such as Sun workstations, Apple computers and PCs. In addition the software is free. There is reason to believe that Java’s popularity will grow.
To facilitate running on different computer platforms, Java programs run on an interpreter called the Java Virtual Machine (JVM). The only system-specific I/O Java programs can perform is that allowed by the JVM such as file, keyboard, and computer monitor access. Java programs do not have a direct way of getting past the Java Virtual Machine interpreter to interface to non- standard I/O devices such as an instrumentation board. The designers of the Java language realized there would be times when Java programs need to leave the JVM and go into the nether
“Proceedings of the 2003 American Society of Engineering Education Annual Conference & Exposition Copyright © 2003, American Society for Engineering Education”
Lin, W., & Pfile, R. (2003, June), Native Instrumentation Board Interface For Java Based Programs Paper presented at 2003 Annual Conference, Nashville, Tennessee. 10.18260/1-2--12507
ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 2003 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015