Monday, March 28, 2011

Printing from an embedded system

We are making a lab instrument using an ARM9/RTOS system. The client has asked about printing simple reports from the ARM9 system. In this case, we have USB Host support in the RTOS. I'm thinking about printing bitmaps in generic PCL, hoping that will cover the widest range of printers. Is there a better way to approach this? I'm assuming the RTOS does not have printer drivers, and I don't want to support a lot of printers.

We also support USB device mode on our system, so you could plug in a photo printer, and our device would appear to be a USB stick. So that would work, but it's a bit clunky. This will be a C/C++ embedded system

From stackoverflow
  • If I understand you correctly, you could write a formatted text file and do a "print" command through Windows in the "usb stick" mode.

    Jeff : Sorry - should have been more clear. No Windows OS is running, just our embedded RTOS.
    Paul Nathan : Oooh, there's no connection to any desktop OS at all?
    Jeff : No - device sits on a lab bench
  • For a simple report, it would be best to stick to straight ASCII. If you need some graphics, PCL would be a good choice for B/W laser printers, but I'm not sure how universal it would be for the more common ink-jet printers.

    Edit: the PCL Reference Manual is available as a PDF from HP.

  • Pretending to be a digital camera and interfacing with a PictBridge printer actually sounds pretty clever. It would remove the need to deal with different printer drivers, and if my understanding of the technology is correct, you could even control the operation of the printer right from your device.

    On the other hand, as someone who has used a fair number of computerized lab instruments (oscilloscopes etc.) I find the ability to save screenshots from an ethernet/web interface to be much more useful. Print is dead.

    Jeff : Thanks - controlling the printer through PictBridge is a good idea
  • PostScript is natively supported by most printers, so you could just send it over the wire, but it would be a lot more cumbersome than straight ASCII. There are libraries, but they're bulky.

  • Have you looked at what all the scope vendors are doing? They all have print options (I think) and I don't know what they are doing to solve this problem.

    Last time I was involved with something like this, we used serial ports to talk to HP printers using PCL. That backfired as everyone quickly stopped making serial printers!

    Jeff : Michael - what is a "scope" vendor? I'm thinking PictBridge solves the currnt problem, but we are still looking at doing PCL over USB, just to print bitmaps only.
    Michael Kohne : Scope meaning oscilloscope - a rather common piece of bench equipment and the first thing that popped into my mind as a near equivalent to your project. The vendors I know are LeCroy, Agilent, Tektronix, and I don't know who else these days. Google for test & measurement.
  • Since your device can appear to be a USB stick, a simple solution would be to generate a report as a JPEG image and then have the printer open and print it. This way, the people who want paperless output can use the image as-is, and everyone else can print it.

    Jeff : Thanks - "have the printer open and print it" is the tricky part. Looks like PictBridge will allow this, that's the solution we are researching now.

0 comments:

Post a Comment