F
freesoft_2000
Hi everyone,
I am trying to write some bits to the parallel port
using the java communications port and all is okay except that i need some
clarification on something.
The parallel port is connected to circuit board that
needs nine inputs(or better known as nine bits)
Now this is what i am doing to write the values to the parallel port
import javax.comm.*;
import java.io.*;
public class PortTest
{
ParallelPort port;
int outputByte = 256; //The byte value is 100000000
public void outputBits()
{
try
{
port.getOutputStream().write(outputByte);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
PortTest p1 = new PortTest();
p1.outputBits;
}
}
Now here is my problem, the output stream only seems to
output to the first eights bits but does not output the last bit which is
a zero. Now i know that a byte is eight bits but if i use a byte array it
still does not work.
Basically my question is that i need to output nine bits
but i seem to be able to only output eight bits and would really
appreciate some guidance from anyone on this topic.
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West
I am trying to write some bits to the parallel port
using the java communications port and all is okay except that i need some
clarification on something.
The parallel port is connected to circuit board that
needs nine inputs(or better known as nine bits)
Now this is what i am doing to write the values to the parallel port
import javax.comm.*;
import java.io.*;
public class PortTest
{
ParallelPort port;
int outputByte = 256; //The byte value is 100000000
public void outputBits()
{
try
{
port.getOutputStream().write(outputByte);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
PortTest p1 = new PortTest();
p1.outputBits;
}
}
Now here is my problem, the output stream only seems to
output to the first eights bits but does not output the last bit which is
a zero. Now i know that a byte is eight bits but if i use a byte array it
still does not work.
Basically my question is that i need to output nine bits
but i seem to be able to only output eight bits and would really
appreciate some guidance from anyone on this topic.
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West