Ports

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
 
J

jan V

The parallel port is connected to circuit board that
needs nine inputs(or better known as nine bits)

*precisely how* is your board connected to your parallel port? The answer to
this question will determine the answer to your question.
 
D

David Segall

freesoft_2000 said:
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)
The parallel port has eight input/output bits and that is what your
circuit board is looking for. The ninth bit is a "strobe" bit and
instructs your circuit board to read (or write) the eight data bits
"now".
 
F

freesoft_2000

Hi everyone,

David that is exactly what i am trying to do by writing to
the strobe bit

Hi everyone,

This is what i did

I have a way to monitor this via the circuit connected to the parallel
port. Now i tried to use byte[] and this is what i have got so far

int i = 1, j = 3;

Integer inti = new Integer(i);
Integer intj = new Integer(j);

byte[] b = new byte[2];
b[0] = inti.byteValue(); //The binary value is 00000001
b[1] = intj.byteValue();//The binary value is 00000011

public void outputBits()
{

try
{
port.getOutputStream().write(b);
}

catch(Exception e)
{
e.printStackTrace();
}

}

Now what happens is b[0] is outputted from pin 1 - pin 7. Now i was hoping
that b[1]
would output from pin 8 - pin 15 but instead it outputted from pin 1 - pin
7 thus overriding the first value.

I really not sure of what else to do and would really appreciate any help
on this topic

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,039
Messages
2,570,375
Members
47,020
Latest member
anuradha

Latest Threads

Top