Linux to emulate/act as a printer.

P

Peteris Krumins

Hello,

I have a device which outputs data to a printer.
I have to collect these data and do smth with them.

Today (working already 15+hours), i read a lot about parallel
port and how data is transmitted/received, so i wired
my own cable:

data to data,
pin 1 (at pc) to pin 11 (at device), so i could write not busy
pin 10 (at pc) to pin 1 (at device), so i could read strobe
pin 16 (at pc) to pin 10 (at device), so i could write ack
pin 17 (at pc) to pins 12 and 15 (at device), so i could write
not out of paper and not error (tell that nothing is wrong with
printer)
ground to ground,
other cables not used.

My idea is to control the status registers, so i (linux box) could
act as a real printer, for example if i saw 'strobe low' (reading
status ack (pin 10 at pc which is connected to device's pin 1),
i'd know device is sending a byte, i would acknowledge that
(by writing to pin 16) and continue reading byte by byte.

Unfortunately something is wrong. I have tested the wiring -
it is ok. I know about hardware invertion in parallel port, so
i high and low pins correctly.

The device just holds 'strobe' high, data bit 2 high and data bit 4
high. As i understand the device waits me (printer) to low busy,
and do the same to error and out of paper. I have done it but the
device never changes those strobe, bit2 and bit4.

If i connect the device to a printer, the printer prints data out
perfectly. I dont have so advanced devices to trap printer and device
to see their conversation..

So something is wrong, i must ask if i have have understood how the
printers work correctly:
1) If there is no paper or is error, those pins are set high.
2) Printer sets busy low, indicating it is ready to accept data
3) Device sets data pins high, putting a byte on the wire, and sets
strobe low.
4) Printer sets busy high, indicating it is processing data
5) Printer reads data pins.
6) Printer sets busy low, sets ack low, waits ~ 5us, highs ack
7) goto 1, procedure continues.

Am i correct?

Also, please, if you know how to do this easier, be so kind and
tell me.


Thanks,
P.Krumins
 
G

Gary Tait

Hello,

I have a device which outputs data to a printer.
I have to collect these data and do smth with them.

Today (working already 15+hours), i read a lot about parallel
port and how data is transmitted/received, so i wired
my own cable:

data to data,
pin 1 (at pc) to pin 11 (at device), so i could write not busy
pin 10 (at pc) to pin 1 (at device), so i could read strobe
pin 16 (at pc) to pin 10 (at device), so i could write ack
pin 17 (at pc) to pins 12 and 15 (at device), so i could write
not out of paper and not error (tell that nothing is wrong with
printer)
ground to ground,
other cables not used.

My idea is to control the status registers, so i (linux box) could
act as a real printer, for example if i saw 'strobe low' (reading
status ack (pin 10 at pc which is connected to device's pin 1),
i'd know device is sending a byte, i would acknowledge that
(by writing to pin 16) and continue reading byte by byte.

Unfortunately something is wrong. I have tested the wiring -
it is ok. I know about hardware invertion in parallel port, so
i high and low pins correctly.

The device just holds 'strobe' high, data bit 2 high and data bit 4
high. As i understand the device waits me (printer) to low busy,
and do the same to error and out of paper. I have done it but the
device never changes those strobe, bit2 and bit4.

If i connect the device to a printer, the printer prints data out
perfectly. I dont have so advanced devices to trap printer and device
to see their conversation..

So something is wrong, i must ask if i have have understood how the
printers work correctly:
1) If there is no paper or is error, those pins are set high.
2) Printer sets busy low, indicating it is ready to accept data
3) Device sets data pins high, putting a byte on the wire, and sets
strobe low.
4) Printer sets busy high, indicating it is processing data
5) Printer reads data pins.
6) Printer sets busy low, sets ack low, waits ~ 5us, highs ack
7) goto 1, procedure continues.

Am i correct?

Keep in mind some of the lines are electrically inverted from their
logical apppearance. Some lines might also be open collector.

What I'd do is get an LPT testing app for the host PC, and something
similar for the linux PC.
Also, please, if you know how to do this easier, be so kind and
tell me.

Easier would be to use serial, with a null modem cable.
 
D

David Segall

Posted and emailed:
Peteris Krumins said:
Hello,

I have a device which outputs data to a printer.
I have to collect these data and do smth with them.

Today (working already 15+hours), i read a lot about parallel
port and how data is transmitted/received, so i wired
my own cable:

data to data,
pin 1 (at pc) to pin 11 (at device), so i could write not busy
pin 10 (at pc) to pin 1 (at device), so i could read strobe
pin 16 (at pc) to pin 10 (at device), so i could write ack
pin 17 (at pc) to pins 12 and 15 (at device), so i could write
not out of paper and not error (tell that nothing is wrong with
printer)
ground to ground,
other cables not used.

My idea is to control the status registers, so i (linux box) could
act as a real printer, for example if i saw 'strobe low' (reading
status ack (pin 10 at pc which is connected to device's pin 1),
i'd know device is sending a byte, i would acknowledge that
(by writing to pin 16) and continue reading byte by byte.

Unfortunately something is wrong. I have tested the wiring -
it is ok. I know about hardware invertion in parallel port, so
i high and low pins correctly.

The device just holds 'strobe' high, data bit 2 high and data bit 4
high. As i understand the device waits me (printer) to low busy,
and do the same to error and out of paper. I have done it but the
device never changes those strobe, bit2 and bit4.

If i connect the device to a printer, the printer prints data out
perfectly. I dont have so advanced devices to trap printer and device
to see their conversation..

So something is wrong, i must ask if i have have understood how the
printers work correctly:
1) If there is no paper or is error, those pins are set high.
2) Printer sets busy low, indicating it is ready to accept data
3) Device sets data pins high, putting a byte on the wire, and sets
strobe low.
4) Printer sets busy high, indicating it is processing data
5) Printer reads data pins.
6) Printer sets busy low, sets ack low, waits ~ 5us, highs ack
7) goto 1, procedure continues.

Am i correct?

Also, please, if you know how to do this easier, be so kind and
tell me.
May I suggest an off-the-shelf parallel to serial converter? This will
allow you to use standard code to read from your device and avoid the
special cable which will mystify anybody who has to maintain your
application.
 

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

Top