Interface Parallel Printer

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Does anyone have information on driving parallel port printers?

I can't seem to find much on a "command list" for parallel port printers or anything, does anyone know of any good links or hints?

Thanks,

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The command list is printer specific. Most modern printers you couldn't do with a micro because they only work in windows (windows does the processing only raw image data goes to the printer) Dot matrix and older bubblejets (and most lasers) have escape code sequences to do anything you want. A micro can drive the parrallel lines by itself without external chips just as long as you current limit it. I don't know how the parralle communications protocol works though. Practicing on a dot matrix will help because it just prints any data sent to it. (If it's a printable charactor)

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Ah, thanks for the info. I was hoping there was some sort of age-old universal parallel port printer protocol that works for most of them for doing only text, but I guess not!

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look up how a parrallel port works. I'm just guessing here from what little I remember the pins being called. You set each data bit, and then trigger the strobe line to send information (this is just a rough guess) Here is the cable pinout I was able to find. Play around with it. Some of the later pins have specific names to them that are for printers, but you may not need to use them just to send data.

http://dynamik.fb10.tu-berlin.de...

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I found another thing that might be useful as well:

http://h20015.www2.hp.com/hub_se...

It talks about the Printer Command Language (PCL), used by DeskJets and whatnot...

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Colin

Printing from an AVR are we?
Well I couldn't really find much besides a s*** load of linux printer drivers.

I found a Parallel port spec which you properly allready knew off
http://www.lvr.com/files/ibmlpt.txt

And some other pages... not much really...
http://www.interfaceembedded.com...

Spend a cup of coffee and a couple of fags but didn't find much... strange

/claus

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

due to cultural diversity present here at the forum I feel obliged to add a comment

fag == cigarette

fag != queer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Colin

A lot of printers can be set up in "straight ASCII" mode where all you need to send is the ASCII for the character you want printing. Others need complex command strings depending on the printer control language.

I have used an old dot-matrix printer (NEC P2200) connected to ports on a micro (8 bits) for data and one bit for strobe and just used slow timing for the output as follows:

1) output data
2) wait
3) set strobe (low going)
4) wait
5) clear strobe (high)
6) wait
7) goto 1

From memory I used 1ms waits and it worked fine.

My NEC printer manual says a minimum STROBE of 1 microsecond with data valid 0.5usec before and after the strobe with the printer BUSY line going active high in response to the STROBE line going low if the printer cannot receive more data. The BUSY line stays high until the printer is ready for the next character.

There is also an "ACKNOWLEDGE" signal from the printer which goes low (for approx 8usec) sometime after the STROBE to indicate the data was received.

Normally you would use the "BUSY" line from the printer to control the output and you could also use the "PAPEROUT" and "SELECT" lines, etc.

You need to look at the printer you want to use and see what signals are available on the interface but I would say use the Busy or acknowledge at least to give some control ( I couldn't in my application because I was monitoring "off-air" and had no control over the data being received - luckily it was slow enough and short enough to use the above method.

HTH
Alan

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am beginning to remember something about all those control signals.
Many years ago, a friend and I made a printerbuffer out of an 8088, some sram and a few other parts. We would emulate printer to the PC, and quickly fill the ram with data. At the same time we would send the received data to a real printer in whatever speed it could process it in.

I should be able to dig up all the material from back then, if you're interested. We didn't use any printer codes. We just forwarded any received data, so this may not be very relevant after all.
But we did use all handshake signals. There might be something interesting there.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Colin,

I have a thermal printer databook at home that uses a subset of PCL. It lists a HP document number regarding the "real" PCL. I will try to remember to look that document number up tonight when I get home and post it here.

Regards,
Steve

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Thanks for all the help so far!

Maybe I should describe my application more:

I want to use a printer for data-logging - but there's a catch. I'm looking at making this perhaps a production device, so I've got to do it "right". This means supporting as many printers as possible (I know I won't be able to support every one).

All I really need is ASCII text, with hopefully the ability to bold/underline words (which PCL looks to support).

For testing I can always go up to Futureshop and test it out on all the printers until they kick me out ;-)

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to use a printer for data-logging - but there's a catch. I'm looking at making this perhaps a production device, so I've got to do it "right". This means supporting as many printers as possible (I know I won't be able to support every one).
=====================
I would suggest that 'right' is not a big sheaf of paper on the floor in the morning, but a serial flash rom that you can dump to a serial port or ir and view on a nice big flat modern display at your leisure.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Actually it will have serial/USB normally, which is the handier one. But sometimes it might be nice to just have a direct print-out I think, so if I could get support for most printers going without much effort I'd do it.

If its too much of a hassle I won't bother, it was just a "fun idea" I had!

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This could be a thorny issue. It can get complicated.
The regular simple ASCII printers have pretty much gone away, except for various Point of Sale types of printers.
It seems one group of printers supports Postscript commands and page formatting, another group supports the HP PCL printer commands. then the third group is pretty much a free for all.
In the third group, the dot matrix, ink jets and other types of laserjet printers, they all have their own proprietary protocols and require their own special drivers, before you can print to them.
What complicates it is the "Plug and Play" nature of all the systems nowadays. Thus the computer system queries the printer to determine if it needs a driver or not and acts accordingly.
It looks as though the old days of just sending ASCII text to a printer is gone.

If you using Windows, and if the printer you have plugged in (without installing a driver for it), supports a GENERIC TEXT driver, then you should be able to use it with your MCU with little difficulty.

As for me, I use the serial port, and output data to a PC, which has a program running for this purpose, to grab the data and stuff it into a file or spreadsheet directly. You can format the data being sent to the PC to be comma delimmited thus making it easy to import into databases or spreadsheets too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even the PCL and postscript printers (in fact most other printers as well) will accept standard text input using the generic text formatting characters (anything you would use in a plain text file, and the form feed character). Depending on the printer the output will be formatted to 80 columns wide.

The problem lies in when you want to play around with font's, sizes, effects, and graphics. At which point each printer has it's own language for controlling those attributes.

If writing your own interface, I suggest PCL, as it's relatively simple. Most PCL printers perform the RIP in the printer itself, the exceptin lies with the 'windows printers' like the HP LaserJet 6L, where part of the RIP is performed on the PC, with the remainder in the printer itself. These windows/driver dependant printers are harder to write for, though they even will usually have support for a limited subset of some scripting language like PCL.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Just did a pleminary test. Tried to send the letter 'A' to the printer, using information at http://www.beyondlogic.org/spp/p... (basically same stuff Alan wrote about).

Printer just stood there... no noise or anything.

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many printers require a CR and LF before printing in basic ASCII mode, they line buffer. To do the stuff you mentioned, no need to use PCL etc., almost all printers less than 20 years old with a parallel interface accept Epson escape codes for bold and underlining. It is good to test the printer with Windows (say) set up as a basic ASCII printer just to make sure.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

most printers will accept plaintext input.

simply dump a text file to the printer, and then follow it with a formfeed character so that it will eject the page, otherwise it may just sit there in the buffer.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Got it to work! Problem was the printer I was trying to use (HP 712C) didn't support plaintext (set it up as generic text printer), when used another printer (HP LaserJet 4L) that supports plaintext worked OK.

I probably won't pursue this much more though - most printers now seem to be going USB, and IMO the DeskJet 712C is a pretty "normal" printer one might have in their home that uses parallel. So not really as compatable as I'd like.

Thanks for everyone's help though!

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey, I remember that the old matrix printers, and even the newer bubble jets (at least some bubble jets) suported a certain ESC sequence thingy.... and almost all were EPSON FX-80 compatIble.

I remember the Canon BJ-10ex user guid had these ESC sequences all documented. I unfortunately sold that printer, long ago.

Ummm... I have here an old and half-pages-missing Citizen 120-D printer booklet. And it contains a table with ESC sequences, and the part that deals with the configuration microswitches, mentions "FX compatibility" all over the place.

I am of the mind that most printers do, in fact, support Epson FX-something and the ESC sequences. Windows printers are still the minority (although a sizeable minority).

Colin, don't give up on this project, I would like to see you complete it, and if you would be so kind, include some of your work into a project I am working on with the 8515.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

New printers do not. Almost any printer made within the last 2 years will have a low chance of supporting escape code sequences of any kind, at least inkjets/bubblejets. Most lasers support at least post script. Dot Matrix printers you don't even have to format if you don't want, they'll generally print any data you send it.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Even though Colin said he wouldn't pursue this even further I thought I would give the information I mentioned in my earlier post. Who knows, maybe someone can use it one day.

My thermal printer manual says:
" it follows almost all of the conventions defined by Hewlett-Packard for PCL as defined in Hewlett-Packard PCL 5 Printer Language Technical Reference Manual P/N 5961-0509."

Regards,
Steve

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think it's probably not a worthwhile idea to develop new stand-alone products to operate with parallel printer interfaces in general. The only advantage of parallel over serial was speed, and now USB is plenty fast enough, and even RS232 should be plenty fast for a data logger. Since Colin has a Future Shop nearby, he can't help but notice how very few new peripheral devices have a parallel port anymore. In fact, I got my newest HP printer there, and I even bought a whole bloody new computer before that just because all the peripherals I needed were USB only, and my other computers run NT, which doesn't support USB, and I just threw my hands in the air and said "I give up"... Of course, if you're building in a printing device to a product, like a thermal printer, then parallel could make sense. But parallel printer ports and even RS232 ports seem to be well on their way out as a consumer-level interface, which is important if you want to use newer consumer-level peripherals.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I've attached a file that will print a few A's on my Laser printer, but not on my DeskJet.

So anyone else who wants to look at it, its just very basic right now. I couldn't seem to get anything from the DeskJet at all, and its pretty hard to diagnose (no error messages can be displayed like on a laserjet). The DeskJet should use PCL, according to HP...

But I am doubting you can print text like I want to, as the user manual explains that you can only print from DOS by running it under Windows (supposedly), and you need to have some other driver installed.

Maybe someone else will pick it up? I'll play around a bit more, but really because of the way printers are going (USB) I'm not going to bother very much with this idea.

Regards,

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can see what you ar sending to the printer by clicking on the 'print to file' box.

Even with a plain text file there's a lot of support code...

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Colin,

your deskjet may not accept plaintext at all, even if it supports PCL. You can try sending a plain PCL script to the printer, below is a webpage that gives a brief overview of some of the PCL commands that you may find helpful.

http://www.nbank.net/~bpage/Basi...

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You will be able to buy paralell laser printers for years. They still sell 9 pin dot matrix's because people use them. The popular standard for connections will take YEARS to switch over to USB fully.

admin's test signature