The Artima Developer Community
Sponsored Link

Java Answers Forum
parallelport

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
CANSU

Posts: 1
Nickname: cansu
Registered: Jan, 2003

parallelport Posted: Jan 22, 2003 4:11 PM
Reply to this message Reply
Advertisement
hi!
I ve a very big problem ..i want to control a steppermotor with java.but firstly i have to succeed in sending some data to parallel port with below codes .
this program is compiled and when i run it, doesn t give any error.but i m sure that there is some problem in that line --> DOSone.write(5);

I tested with assembly.and i saw that this codes have mistake.because no data were sent to parallel port ,after program run(actually, 5 must be sent).But as i sad, there is no error while compiling or running.if you look and find where the mistake is,i ll be so happy..bacause this is my term project..
thanks a lot..

import java.io.*;
import java.util.*;
import javax.comm.*;
import java.lang.*;

class ParallelWrite
{
static Enumeration portListesi;
static CommPortIdentifier portId;
static ParallelPort parPort;
static OutputStream outputstream;
static OutputStreamWriter DOSone;

public static void main (String arg[])
{
portListesi = CommPortIdentifier.getPortIdentifiers();
while (portListesi.hasMoreElements())
{
portId = (CommPortIdentifier) portListesi.nextElement();
if((portId.getPortType()==CommPortIdentifier.PORT_PA RALLEL)&&((portId.getName()).compareTo("LPT1")==0))
{
try
{
parPort = (ParallelPort) portId.open("Parallel Test", 3000);

try
{
DOSone = new OutputStreamWriter(parPort.getOutputStream());
}catch(IOException e){}
try
{
DOSone.write(5);
DOSone.close();
parPort.close();
}catch(IOException e){}

} catch (PortInUseException e) {
System.err.println(e.toString());
System.exit(1);
}
}
}
}
}

Topic: JComboBox Popup Previous Topic   Next Topic Topic: Java Mail

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use