Shop OBEX P1 Docs P2 Docs Learn Events
Centronics parallel to serial conversion — Parallax Forums

Centronics parallel to serial conversion

John BondJohn Bond Posts: 369
edited 2006-10-18 06:16 in General Discussion
Hi Guys
·
Has anyone got the code for a Parallel to serial converter?
·
We want to run a serial printer off a parallel port.
·
We have some old test equipment in our factory that uses Centronics parallel printer ports, unfortunately, we have standardized on (equally old) serial label printers. One used to be able to buy a converter but everything is USB there days and the “Western disposal culture” dictated that we just chuck perfectly good stuff away because it doesn’t have a USB V2.0 sticker on it. Someone has just caught up with me on the shop floor and said “Bond, you’re into electronics, why not just make a parallel to serial converter?” Well…
·
The circuit can’t be too difficult, but the software frightens me. How do you handle flow control, what about the roughly 10 parallel lines that seem to go the wrong way, from printer to computer?
·
An intriguing problem, any comments would be welcome.
·
From South Africans where we communicate in 11 different official languages. Parallel to Serial must be easier than that.
John Bond

Comments

  • ForrestForrest Posts: 1,341
    edited 2006-10-16 16:26
    The hardware should be easy - the tricky parts is writing a Windows printer driver. Before undertaking such a task, I'd check with the serial printer manufacturer to see if they sell such a device.
  • John BondJohn Bond Posts: 369
    edited 2006-10-17 07:47
    Hi Forrest

    The Test PCs are DOS based 486 machines. Lots of ports, plenty opto isolation, even on the printer ports, very robust. They've been around for 10 years. It just outputs a label to a parallel printer.

    What I didn't mention because it didn't seem relevant is that I have a logger on the serial printers that captures the label information and writes it to an OBDC database on our server for tracebility reasons. Just to keep things simple, think of a Parallel port on a computer writing to a Serial port of a printer.

    Buying a converter is the logical way to go. I used one in the early 80's. It was about the size of a box of chocolates and had a dozen ICs. This time round, we've looked for such devices, we've googled, I've spoken to the National Instrument rep. I've contacted RS Components (the UK equivilent of Digikey). We've even spoken to one of the local PIC developers.

    I don't seem to get unstuck when it comes to serial 232 comms (thanks to Stampworks, G
  • ForrestForrest Posts: 1,341
    edited 2006-10-17 10:37
    I went to the Computers area of www.ebay.com and searched on 'parallel to serial' and found a model SP-100 Parallel to Serial Converter
  • John BondJohn Bond Posts: 369
    edited 2006-10-17 10:50
    Hey Forrest, your a star... Thanks.

    I didn't think to look at eBay, they have a varierty of old redundant stock, and at rediculously low prices, just 10 bucks or 80 Rands.

    John Bond
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-10-17 15:15
    John,

    dealing with an "old", or "classical" Centronics parallel port is not really difficult. It has the following pins:

    1 - O - STROBE*
    2 - O - D0
    3 - O - D1
    4 - O - D2
    5 - O - D3
    6 - O - D4
    7 - O - D5
    8 - O - D6
    9 - O - D7
    10 - I - ACK*
    11 - I - BUSY
    12 - I - PE
    13 - SEL
    14 - O - AUTOFD*
    15 - I - ERROR*
    16 -O - INIT*
    17 - O - SELIN*
    18...25 GND

    Where "O" means output, and "I" means input (when you "look" into the PC's parallel port). An asterisk (*) marks negative logic.

    So, here is a rough scheme for a simple parallel to serial conversion in kinda BASIC dialect:

    WaitForNextChar:
    Let BUSY = low
    Let ACK = high

    WaitForStrobeLow:
    If STROBE* = high then goto WaitForStrobeLow
    Read D0...D7 from the port into a byte variable
    Let ACK* = low
    Let BUSY = high

    Pass byte variable to a serial transmitter VP to send it to the serial printer

    WaitForTxDone:
    If SerialTransmit <> Done then goto WaitForTxDone

    WaitForStrobeHigh:
    If STROBE* = low then goto WaitForStrobeHigh

    Goto WaitForNextChar:

    It depends on the serial printer, if there is a handshake required on the serial side. So you might check what kind of handshake the serial printer can handle. Many printers make use of the RTS/CTS lines which is pretty easy to implement. Others use an XON/XOFF protocol which requires some more tricks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • John BondJohn Bond Posts: 369
    edited 2006-10-18 06:16
    Thanks G
Sign In or Register to comment.