• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parallel port writing in Windows XP  RSS feed

 
Bob Butcher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some assistance with accessing the parallel port using Java within a Windows XP Pro operating system. I am aware that Microsoft does not allow Windows XP to have access to the ports directly, but supposedly I have that problem covered. I also understand that Sun pulled the COMM API from their website, claiming that RXTX replaces it. I also have found several web-sites which claim to allow access to the serial and parallel ports from Windows NT, XP, etc, including Parport and Userport. I have downloaded and installed these two programs as well as RXTX, following the instructions as closely as I could. There are sample applications on the websites for the latter two programs that are supposed to test the system, but I cannot get any of them to work correctly. I am logged on as administrator.

For example when I run SimpleIO.java (shown below) from a DOS window, it compiles but produces an error message.

import parport.ParallelPort;
//import java.lang.Object.javax.comm;
class SimpleIO {
public static void main ( String []args )
{
ParallelPort lpt1 = new ParallelPort(0x378); // 0x378 is normally the base address for the LPT1 port
int aByte;
aByte = lpt1.read(); // read a byte from the port's STATUS pins
System.out.println("Input from parallel port: " + aByte);
aByte = aByte >> 2; // a simple and irrelevant operation
lpt1.write(aByte); // write a byte to the port's DATA pins
System.out.println("Output to port: " + aByte);
}
}

The DOS window displays:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\Documents and Settings\Owner\My Documents\javawork>java SimpleIO
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x10001057, pid=3968, tid=3976
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) Client VM (23.1-b03 mixed mode, sharing windows-x86
)
# Problematic frame:
# C [parport.dll+0x1057]
#
# Failed to write core dump. Minidumps are not enabled by default on client vers
ions of Windows
#
# An error report file with more information is saved as:
# D:\Documents and Settings\Owner\My Documents\javawork\hs_err_pid3968.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

D:\Documents and Settings\Owner\My Documents\javawork>

The error log shows:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x10001057, pid=3968, tid=3976
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) Client VM (23.1-b03 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [parport.dll+0x1057]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

--------------- T H R E A D ---------------

Current thread (0x003c8400): JavaThread "main" [_thread_in_native, id=3976, stack(0x008c0000,0x00910000)]

siginfo: ExceptionCode=0xc0000096

Registers:
EAX=0x00000000, EBX=0x32acf718, ECX=0x003c0379, EDX=0x00000379
ESP=0x0090fc6c, EBP=0x0090fc78, ESI=0x32acf718, EDI=0x003c8400
EIP=0x10001057, EFLAGS=0x00010246

Top of Stack: (sp=0x0090fc6c)
0x0090fc6c: 10001016 003c0379 003c0379 0090fcb0
0x0090fc7c: 0094a6e7 003c8528 0090fcb8 00000379
0x0090fc8c: 003c8ae4 0090fc90 32acf718 0090fcc0
0x0090fc9c: 32acf9e0 00000000 32acf718 00000000
0x0090fcac: 0090fcc0 0090fce4 0094340f 22aee300
0x0090fcbc: 00948979 00000379 0090fcc4 32acf5fe
0x0090fccc: 0090fcec 32acf9e0 00000000 32acf608
0x0090fcdc: 0090fcc0 0090fcec 0090fd10 0094340f

Instructions: (pc=0x10001057)
0x10001037: 66 8b 45 fc 50 e8 2f 00 00 00 83 c4 08 8b e5 5d
0x10001047: c2 10 00 cc cc cc cc cc cc 33 c0 66 8b 54 24 04
0x10001057: ec c3 66 8b 54 24 04 66 ed c3 66 8b 54 24 04 ed
0x10001067: c3 cc cc cc cc cc cc cc cc 33 c0 66 8b 54 24 04


Register to memory mapping:

EAX=0x00000000 is an unknown value
EBX=0x32acf718 is an oop
{method}
- klass: {other class}
ECX=0x003c0379 is an unknown value
EDX=0x00000379 is an unknown value
ESP=0x0090fc6c is pointing into the stack for thread: 0x003c8400
EBP=0x0090fc78 is pointing into the stack for thread: 0x003c8400
ESI=0x32acf718 is an oop
{method}
- klass: {other class}
EDI=0x003c8400 is a thread


Stack: [0x008c0000,0x00910000], sp=0x0090fc6c, free space=319k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [parport.dll+0x1057]
j parport.ParallelPort.readOneByte(I)I+0
j parport.ParallelPort.read()I+6
j SimpleIO.main([Ljava/lang/String;)V+12
v ~StubRoutines::call_stub
V [jvm.dll+0x12964a]
V [jvm.dll+0x1d851e]
V [jvm.dll+0x1296cd]
V [jvm.dll+0xae244]
V [jvm.dll+0xb85b7]
C [java.exe+0x1fd8]
C [java.exe+0xa0cb]
C [java.exe+0xa155]
C [kernel32.dll+0xb729] GetModuleFileNameA+0x1ba

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j parport.ParallelPort.readOneByte(I)I+0
j parport.ParallelPort.read()I+6
j SimpleIO.main([Ljava/lang/String;)V+12
v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x02a74000 JavaThread "Service Thread" daemon [_thread_blocked, id=4004, stack(0x02e00000,0x02e50000)]
0x02a66000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=4000, stack(0x02db0000,0x02e00000)]
0x02a64800 JavaThread "Attach Listener" daemon [_thread_blocked, id=3996, stack(0x02d60000,0x02db0000)]
0x02a63000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3992, stack(0x02d10000,0x02d60000)]
0x02a54c00 JavaThread "Finalizer" daemon [_thread_blocked, id=3988, stack(0x02cc0000,0x02d10000)]
0x02a50000 JavaThread "Reference Handler" daemon [_thread_blocked, id=3984, stack(0x02c70000,0x02cc0000)]
=>0x003c8400 JavaThread "main" [_thread_in_native, id=3976, stack(0x008c0000,0x00910000)]

Other Threads:
0x02a4e400 VMThread [stack: 0x02c20000,0x02c70000] [id=3980]
0x02a76400 WatcherThread [stack: 0x02e50000,0x02ea0000] [id=4008]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation total 4928K, used 289K [0x22ab0000, 0x23000000, 0x28000000)
eden space 4416K, 6% used [0x22ab0000, 0x22af8500, 0x22f00000)
from space 512K, 0% used [0x22f00000, 0x22f00000, 0x22f80000)
to space 512K, 0% used [0x22f80000, 0x22f80000, 0x23000000)
tenured generation total 10944K, used 0K [0x28000000, 0x28ab0000, 0x32ab0000)
the space 10944K, 0% used [0x28000000, 0x28000000, 0x28000200, 0x28ab0000)
compacting perm gen total 12288K, used 127K [0x32ab0000, 0x336b0000, 0x36ab0000)
the space 12288K, 1% used [0x32ab0000, 0x32acfd58, 0x32acfe00, 0x336b0000)
ro space 10240K, 42% used [0x36ab0000, 0x36eee580, 0x36eee600, 0x374b0000)
rw space 12288K, 54% used [0x374b0000, 0x37b2f128, 0x37b2f200, 0x380b0000)

Code Cache [0x00940000, 0x009d8000, 0x02940000)
total_blobs=139 nmethods=8 adapters=67 free_code_cache=32183Kb largest_free_block=32955776

Compilation events (10 events):
Event: 0.279 Thread 0x02a66000 4 java.lang.String::indexOf (87 bytes)
Event: 0.280 Thread 0x02a66000 nmethod 4 0x009d0e08 code [0x009d0f10, 0x009d104c]
Event: 0.302 Thread 0x02a66000 5 java.lang.AbstractStringBuilder::ensureCapacityInternal (16 bytes)
Event: 0.302 Thread 0x02a66000 nmethod 5 0x009d1188 code [0x009d1290, 0x009d133c]
Event: 0.358 Thread 0x02a66000 6 java.lang.Object::<init> (1 bytes)
Event: 0.358 Thread 0x02a66000 nmethod 6 0x009d13c8 code [0x009d14c0, 0x009d1550]
Event: 0.358 Thread 0x02a66000 7 java.lang.String::indexOf (166 bytes)
Event: 0.359 Thread 0x02a66000 nmethod 7 0x009d15c8 code [0x009d16e0, 0x009d1910]
Event: 0.485 Thread 0x02a66000 8 java.io.Win32FileSystem::normalize (143 bytes)
Event: 0.486 Thread 0x02a66000 nmethod 8 0x009d1c08 code [0x009d1d50, 0x009d1fc4]

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (3 events):
Event: 0.059 Thread 0x003c8400 Threw 0x22ab4f28 at C:\jdk7u5_32P\jdk7u5\hotspot\src\share\vm\prims\jni.cpp:3993
Event: 0.184 Thread 0x003c8400 Threw 0x22ae8f08 at C:\jdk7u5_32P\jdk7u5\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.357 Thread 0x003c8400 Threw 0x22aed118 at C:\jdk7u5_32P\jdk7u5\hotspot\src\share\vm\prims\jvm.cpp:1166

Events (10 events):
Event: 0.178 loading class 0x3818dae0
Event: 0.178 loading class 0x3818dae0 done
Event: 0.180 loading class 0x381aed00
Event: 0.180 loading class 0x381aed00 done
Event: 0.180 loading class 0x381833f8
Event: 0.181 loading class 0x381833f8 done
Event: 0.357 loading class 0x02a8b6f8
Event: 0.357 loading class 0x02a8b6f8 done
Event: 0.482 loading class 0x380ba968
Event: 0.482 loading class 0x380ba968 done


Dynamic libraries:
0x00400000 - 0x0042f000 C:\WINDOWS\system32\java.exe
0x7c900000 - 0x7c9b2000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f6000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f03000 C:\WINDOWS\system32\RPCRT4.dll
0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
0x7e410000 - 0x7e4a1000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f59000 C:\WINDOWS\system32\GDI32.dll
0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\msvcrt.dll
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x78aa0000 - 0x78b5e000 C:\Program Files\Java\jre7\bin\msvcr100.dll
0x6d880000 - 0x6dbca000 C:\Program Files\Java\jre7\bin\client\jvm.dll
0x71ad0000 - 0x71ad9000 C:\WINDOWS\system32\WSOCK32.dll
0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x5cd70000 - 0x5cd77000 C:\WINDOWS\system32\serwvdrv.dll
0x5b0a0000 - 0x5b0a7000 C:\WINDOWS\system32\umdmxfrm.dll
0x6d810000 - 0x6d81c000 C:\Program Files\Java\jre7\bin\verify.dll
0x6d2f0000 - 0x6d310000 C:\Program Files\Java\jre7\bin\java.dll
0x6d860000 - 0x6d873000 C:\Program Files\Java\jre7\bin\zip.dll
0x10000000 - 0x1000b000 C:\Program Files\Java\jdk1.7.0_05\bin\parport.dll
0x59a60000 - 0x59b01000 C:\WINDOWS\system32\dbghelp.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll

VM Arguments:
java_command: SimpleIO
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=.;labjack.jar\;.;gnu/io;D:\Documents and Settings\Owner\My Documents\software\Arduino\arduino-0023\lib\RXTXcomm.jar
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Autodesk Shared;D:\Program Files\Java\jdk1.7.0_01\bin;D:\Windows;D:\WINDOWS\system32;D:\Program Files\Design Explorer 99 SE\System;D:\Program Files\Design Explorer 99 SE;D:\Program Files\LabJackU12Legacy\LabVIEW_RTE_Install;C:\PROGRA~1\COMMON~1\AUTODE~1;C:\Program Files\Java\jdk1.7.0_05\bin
USERNAME=User
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 3 Stepping 3, GenuineIntel



--------------- S Y S T E M ---------------

OS: Windows XP Build 2600 Service Pack 3

CPU:total 1 (1 cores per cpu, 1 threads per core) family 15 model 3 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, tsc

Memory: 4k page, physical 1302004k(746912k free), swap 3106024k(2688448k free)

vm_info: Java HotSpot(TM) Client VM (23.1-b03) for windows-x86 JRE (1.7.0_05-b05), built on May 15 2012 18:11:27 by "java_re" with unknown MS VC++:1600

time: Mon Jul 16 21:39:22 2012
elapsed time: 0 seconds
 
Bob Butcher
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found a combination that works. I downloaded Jnpout32pkg_v10 and followed the instructions. The sample program included ioTest.java is capable of writing and reading the parallel port in Windows XP. Now I can work on incorporating the code in my greenhouse control program, and developing the hardware needed.

Bob
 
Paul Clapham
Sheriff
Posts: 22505
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greenhouse control? Maybe you should be checking out the Ranch's sister forum?

Anyway, thanks for posting back with your solution.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!