Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Talking directly to a parallel and serial port  (Read 1290 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 48
Projects: 11


Monkey for a head


« Posted 2003-05-29 08:34:16 »

Is it possible to interface directly to the parallel or serial ports of a computer with pure java? Or do i need to switch over to C/C++ for this?

I need fairly fine control, not just sending packets of information, but flipping on/off the voltages of the pins individually (trying to communicate to a GBA in UART mode Grin )

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #1 - Posted 2003-05-29 09:14:01 »

This might help:

http://java.sun.com/products/javacomm/

Offline William

Junior Member




No Exit


« Reply #2 - Posted 2003-05-29 09:23:17 »

The Java Communications API lets you do this (http://java.sun.com/products/javacomm/). Sun has implementations for Windows and Solaris and there are open source implementations for Linux and other OS's.

I'm not sure if it allows switching the pins on and off individually but I would recommend checking out the open source implementations since some of them seem to support more features than the ones from Sun. I used JCA in my last project to talk with my motion capture controller and explicitly had to set the DTR flag so it does allow some pin-level control.

The only really bad thing about the API is that it does not come with a nice installer, one has to copy the files manually into the right directories of the JRE. This wasn't a problem for me since I had complete control over my platform, but it could be a problem for products that are meant to be mass-distributed.
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline Orangy Tang

JGO Kernel


Medals: 48
Projects: 11


Monkey for a head


« Reply #3 - Posted 2003-05-29 09:30:08 »

Ooo, I hadn't seen that package before - looks promising. Smiley A quick glance over the API shows that you can write individual bytes, so I assume you can affect all the bits by constructing the bytes to send appropriatly (although my knowledge of these ports in general is very lacking, i need to hunt around for more info).

Not having a proper installer isn't really too much of a worry - its mainly just a small side project, and i doubt many people will have the hardware to be able to use it and want to use it from Java. I will probably end up doing a C++ version as well, but i figured the Java one would be easier to start with..

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #4 - Posted 2003-05-31 13:23:52 »

Orangy, that package is pretty cool, and works well. I've used it for all sorts of things in live TV so it's pretty reliable....

EXCEPT: the Win32 version is broken under Java 2's security model - it throws an NPE and breaks immediately! Yes, you read right! Agh! And I don't think they've bothered to fix it even now! But have no fear, the jar can be reverse engineered and hacked, or better still, you can swap the broken classes out with the Solaris implementation - which mysteriously has been fixed :-/

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 48
Projects: 11


Monkey for a head


« Reply #5 - Posted 2003-05-31 14:06:24 »

Well I installed it, and the simple write demo compiled and everything seemed good - until I tried to actually run the damn thing. Kept giving me an empty list of avalible ports - but i stumbled across a post on the java.sun.com forums that explains that the install info is wrong Angry Apparently the .dll needs to sit in the \Program Files\jre\bin dir on an NT machine.

After that it seems to work ok, so they must have fixed whatever bug you bumped into Cas.

Unfortunatly i seem to have some problems with flow control. This is probably a problem with my GBA code though, information on the UART mode with the FIFO queue is minimal to say the least Cry

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (76 views)
2013-05-17 21:29:12

alaslipknot (88 views)
2013-05-16 21:24:48

gouessej (117 views)
2013-05-16 00:53:38

gouessej (113 views)
2013-05-16 00:17:58

theagentd (125 views)
2013-05-15 15:01:13

theagentd (112 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (178 views)
2013-05-12 15:36:09

UnluckyDevil (186 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 22 queries.