If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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.

The doc for OutputStream.write(int) says that it only writes a byte from the low order 8 bits. I don't see any way to write anything but byte(s). The write(byte[]) method would allow you to write more than one byte.
I don't know how the 9 bits you want to send would be stripped out of the 16 in 2 bytes.
Do you have a way to observe what's going out with a write()? Then you could try different arrangements of the 9 bits in the 2 bytes.
Norm

I thought that parallel ports sent 1 byte at a time vs serial port sending a bit at a time.
What you are observing seems to be that byte[0] is sent first and byte[1] is sent next. That is what I'd expect.

What are the specifications for usages of the 25 pins?

BTW Using Integer and .getByteValue() seems like the hard way to initialize a byte array.

Your specs only show 4 bits for data. Pins 3-6. Would that imply that you only send half a byte at a time? I'm only guessing of course. I would think parallel means x bits at a time, while serial only sends 1 bit at a time, a byte taking 8 sends (plus parity).

Good, now we're making progress. Now you need to determine which 4 bits of a byte are being transmitted when you do a write. Then to write a full byte will take 2 writes. Say it's the lower 4 bits. Write the byte, then shift it to the right 4 bits and write it again.
If the bits were numbered: 76543210 you would write 3210 on the first write and 7654 on the second.
What is the reading device expecting? It needs to be in synch with what you're doing,

Research on web at HowStuffworks site defines the pins as follows:
1= Strobe >Same as yours BUT not part of data written. IE you don't control the value of this bit.

2=data0 >Yours is called parity. Being your bit you can put anything here you want.
3-6 =data1-4 >Same as yours
7=data5 >Yours is Request Data. Being your bit you can put anything here you want
8=data6 > Yours Internal Error Check. Being your bit you can put anything here you want
9=data7 > Yours Internal Security. Being your bit you can put anything here you want

10=Acknowledge
...

So according to HowStuffworks, when you write a byte on a parallel port, the 8 bits would go out on pins 2-9. I don't know how you can control what is written to pins 1 and 10 thru 25.

Earlier you said:
b[0] is outputted from pin 1 - pin 7.
That's only 7 bits, the write should be outputing 8. Are you sure that only 7 bits are received and not 8 on pins 2 thru 9?

Bottom line - You can only write 8 bits at a time, on pins 2 thru 9. The other pins are used by the hardware for whatever. If you want to control more than those 8 bits, you'll need your own hardware board on the computer to do the write.

Who designed this circuit that you're trying to communicate with? Why didn't they know how PC parallel ports work? What is their explanation or expectation?

Research on web at HowStuffworks site defines the pins as follows: 1= Strobe >Same as yours BUT not part of data written. IE you don't control the value of this bit.

My bit numbers start from 0. So the pin 1 you are talking about is actually pin 0 which i do not write anything too as i do not control it.

Originally Posted by Norm

Earlier you said:
b[0] is outputted from pin 1 - pin 7.
That's only 7 bits, the write should be outputing 8. Are you sure that only 7 bits are received and not 8 on pins 2 thru 9?

Sorry its a typo. What i meant is pin 1 - pin 8

Originally Posted by Norm

Bottom line - You can only write 8 bits at a time, on pins 2 thru 9. The other pins are used by the hardware for whatever. If you want to control more than those 8 bits, you'll need your own hardware board on the computer to do the write.

I think i have to ask the designer to redesign this circuit

Originally Posted by Norm

Who designed this circuit that you're trying to communicate with? Why didn't they know how PC parallel ports work? What is their explanation or expectation?

The lead engineer that designed this circuit is fresh out of university as the previous lead engineer retired about a month ago. The new engineer said that all pins of parallel port can be used for communication and it was a programming error and not his. I also had felt something amiss.

Originally Posted by Norm

Good luck,
Norm

Thanks man as i think i am going to need it.

Its really been a pleasure interacting with you norm and hope someday i can return the favour

Thank You

Yours Sincerely

Richard West

ps. Hey novax, why don't go and read the full post at Sun's forum. No one cares dude. Even after he posted that at Sun's site i still got replies on this topic. I have a feeling that novax = sjasja = carpaltunnel, they are the same people as they seem to talk the same way and always harass everyone at Sun's website. Point to note, write them off.

Sjalle if you are there please erase the second last post(by novax)
if possible as i feel its a nuisance and a waste of your bandwith