Question

  • Creator
    Topic
  • #2136228

    Need a solution for Serial Port

    Locked

    by bristar ·

    Don’t let this question trip you up. I have a legacy application that cannot be upgraded or replaced. The application can only use a printer on a serial port, but the custom printers we use do not have serial connections.

    The current way this is working (with problems) is to run a USB-Serial converter, which connects to a Serial-Parallel connector. The current printer has a parallel port.

    This produces a few errors, and the next model printer we are rolling out has no parallel connection, so we need a new solution to emulate a serial port on the PC, but port the data to the USB or NIC card on the printer.

    I cannot change printer, computer or program. No upgrades to anything except the cabling in between. If there is a Virtual COM port driver or cable available, I cannot find it. Can anyone offer a possible solution to help?

All Answers

  • Author
    Replies
    • #2428060

      Clarifications

      by bristar ·

      In reply to Need a solution for Serial Port

      Clarifications

    • #2428050

      what O/S are you running the legacy application on?

      by cg it ·

      In reply to Need a solution for Serial Port

      I assume it’s a Windows program.

      If you can run it on Windows XP, then you can use newer printers.

    • #2428042

      NET USE command

      by glen.harris ·

      In reply to Need a solution for Serial Port

      Install USB printer.
      Share the printer and name it.
      Open an elevated command prompt.
      NET USE LPT1: \\[Computer-Name]\Printer /PERSISTENT:YES
      Where computer-name is the name of the PC that the printer is attached to and Printer is the name you gave the printer.
      When the application now tries to print to the parallel port the printout will be directed to the USB printer.

      • #2428018

        Reponse To Answer

        by gechurch ·

        In reply to NET USE command

        Nice idea – it would be very simple so likely to work. Unfortunately Bristar will not have parallel on the new printer so won’t be able to do this (it sounds like the software will only send out over serial anyway – not over LPT1). Just for my own interest – does this work when you’ve got a network printer at the other end? I’ve only ever used this trick to make all PCs think they are printing to a printer that actually is plugged in to the parallel port (ie. redirect LPT1 on this PC to LPT1 on another PC).

        Perhaps redirecting COM1 will work. I’ve never tried this, but Google suggests it’s possible. I don’t see how this can work though. Sure, the serial output from the software will end up going to the correct device over ethernet, but it will still be a serial stream. Surely the device receiving it won’t be able to interpret it??

    • #2428039
      Avatar photo

      Found a couple of links that may help

      by Wizard57M-TR ·

      In reply to Need a solution for Serial Port

      http://www.ehow.com/how_6038655_configure-usb-port-serial.html

      http://www.lvr.com/usb_virtual_com_port.htm

      The second link is quite detailed…the first may give you better pointers.

      You mentioned you have the USB to Serial converter, so it may be something in the setup of the converter.
      Last thing I can think of is if there was a way to add a serial connection to the printer itself? Way back in the day, I had an OkiData Microline 320 that had both serial and parallel ports. However, I haven’t seen anything like this for newer “USB” printers. So, maybe the addition of a Parallel to USB/Serial converter?
      http://www.ehow.com/way_6170190_parallel-port-usb-conversion.html

      PS…just thought of something else…if you have an old computer handy, with true serial/parallel ports, it may be possible to add a NIC to the old computer, then add it to your network, and basically use it as a “print server” for the old software. Would take a bit more work, but might get rid of the errors you mentioned.

    • #2428016

      I don’t think you can

      by gechurch ·

      In reply to Need a solution for Serial Port

      I will definitely state up front that I don’t know much about either serial or parallel specifications. I’m very open to being proved wrong, but to my simple way of thinking I just can’t see how this is possible.

      In your current set up your application sends to a COM port, which physically gets sent over a USB cable but gets adapted back to its original serial stream at the other end. It’s effectively serial to serial communication, just with a different cable in between (no different to the adapters that let you adapt serial to Ethernet then back again). And from what I’ve read in the past few minutes, serial-to-parallel is quite possible (if a little fiddly) to do. Since your current printer has a parallel port (and this is the salient point), it can interpret the signal that’s coming in and knows what to do with it. So I see why your current set up works.

      Your new printer does not have a parallel port though. So while you can no doubt get cabling to take your applications serial output and get it to go into your new printer over the Ethernet (or USB) cable, how can you get the Ethernet printer to make sense of what’s coming in? I know that the USB-to-serial cables only work one way, and serial-to-Ethernet adapters look to be the same. And from what I can tell there are no devices on the market that do what you want. That suggests pretty strongly to me that I’m right, meaning what you want to do isn’t possible.

      So where from here? If it were me, I would run Hyperterm and watch the output when you print from your application. If you are really lucky what you see will be all plain-text. If that were the case, I would find or write software that takes the stream of output and saves it to a .txt file in a directory somewhere. You could then write a helper program that looks for new files in this directory. Any time if finds one it prints it to your new printer, then deletes (or archives) the .txt file. If you need to write the software, then you should be able to skip the middle step and just print the text to your printer directly.

      If you are less lucky you might see a bunch of plain text, with undecipherable binary in-between. This binary will be information that the printer interprets; things like “start printing in bold now”. If it were me, and if it were acceptable, I think I would write a program that strips out the binary and prints the plain text that’s left. You wouldn’t end up with a well-formatted page, but you would have all the content. If you contact the manufacturer of your old printer they may be kind enough to provide the specification. If not, and if you were persistent you may be able to figure out what the binary codes mean yourself. If you could figure out the ‘start bold’ and ‘end bold’ markers for example, you could then replace them with b and /b HTML tags and output to an .html file instead of .txt. Figure out enough and you can format your reports properly.

      If you are unlucky you will see lots of binary code in Hyperterm. This might be because graphics are used (these were typically proprietary specs in old serial printers, so good luck interpreting those!).

      If you get all binary code, it’s likely that Hyperterm is not set up right (wrong baud rate etc). It could also mean that your application is not outputting ascii.

      How far you go with this will depend on the cost of change of the application or printer. Personally I wouldn’t go past the stage of figuring out binary codes and converting the output to HTML. That’s more than messy enough. If graphics are involved then I’d say the task at hand is near impossible.

      Don’t be afraid to go back to management with an honest report of the situation. I know you said it’s not possible to change application or printer, but it is always possible. If you said “it’s impossible to get these new printers talking to our old software” management would definitely change one or the other. If you think management might not believe you, then I’d recommend contacting a reputable software company in your area and have them quote the cost to implement the serial-to-txt/html-to-new printer application. The cost of building that application would likely give them incentive to replace either the app or the new printer. And if not – at least it’s not your responsibility to code this horrible interface!

    • #2428001

      If the print drivers are built in to the application

      by ahadenfeldt ·

      In reply to Need a solution for Serial Port

      then sharing a Windows queue (NET USE) may be problematic. To be clear: NET USE is an elegant solution if it works for you, though my concern is that it might not.

      Ironically there used to be a significant market for serial/parallel<->TCP solutions–largely faded–though there are still port emulators around. For a free solution take a look at com0com.sourceforge.net and its related com2tcp module for the telnet (TCP) piece. If your app does its own print drivers this is probably all you need to connect to the new printer’s raw port (TCP over network).

      P.S.: If you also happen to be looking into virtualization, most VM technologies support virtual serial/parallel ports. If not I completely understand that’s perhaps more complexity than you want.

    • #2427982

      Serial-ethernet

      by tbomb ·

      In reply to Need a solution for Serial Port

      As GEChurch eluded to (and likely didn’t realize) there is a solution and I’ve had unfortunately had to use it. They do make comm modules that translate serial to ethernet and would allow you to take the serial communication from the PC and translate it to the ethernet connection of your new printer. We even used a class 1 bluetooth to serial adapter which allowed up to 330ft between the computer and the serial adapter. Eventually I needed the bluetooth adapter for a cisco switch that was giving me problems and required constant monitoring. So I switched to an actual serial card. This is actually going to be very much preferred as USB to serial adapters commonly cause issues to due timing problems. USB is not a throttled communication like serial so any speed adjustments have to be handled by the “drivers” that come with the usb dongle. Unfortunately as you are finding out not only are the majority of those “drivers” not made very solid, but the process tends to loose data along the way with no sort of recovery. This is what makes the serial to ethernet work so well is that network connections have packet loss and recovery built in using the two way communications. When the other end doesn’t respond with an “ack” they system reaslized the packet didn’t make it or didn’t make it intact and it resends it. But serial doesn’t do that. This makes the serial portion of that serial/ethernet connection the weekest link so to shore that up a bit you need to remove the USB element of it and put in a serial card. If you can find a system that has a PCI bus you can easily find a serial card. If you have a laptop with PCMCIA or Express Card (or even internal mini PCI-e) you can also easily find serial. Hell I had a Compact Flash serial card and two ISA cards I just threw away.

      So nutshell, get rid of the USB dongle, get a serial card, and use serial to ethernet. All the info and gear is online and now that you know what to look for it should be no problem locating it.

      Good luck, been exactly where you are and it sucks! And you have it worse since we still had ISA slots in some computers and PCI in all of them so adding a serial card was no prob.

    • #2427976

      Need a solution for Serial Port – Have a cable custom made

      by aferraro44 ·

      In reply to Need a solution for Serial Port

      I had a legacy application that needed a USB to Serial Cable (25 pins) and had one made at Micro Computer Cable, LLC http://www.mc3llc.com/.

      The cable attaches from a PC running XP to a CNC Milling machine from MAZAK.

      I gave them a schematic of the pin-outs I needed and the gave me a quote (very reasonable), the cable is still in use two years later and it is going strong with no glitches.

    • #2427954

      Assuming I’m understanding your question you need to convert a USB printer

      by charles bundy ·

      In reply to Need a solution for Serial Port

      to accept serial input from the computer. Found this –

      http://www.ipcas.com/download/brochures-data-sheets/rs232-usb-converter.pdf

      Hope this helps!

      ADDENDUM:
      To elaborate on [glen.harris] & [ahadenfeldt]

      If the printer has USB and the computer has USB, why don’t you hook up the printer via a USB cable, share it on the network and do the following command:

      [b]net use COMx \\computer_name\printer_name /persistent:YES[/b]

      NOTE: COM port should be unused e.g. COM8

      Try [I]raw[/I] mode if queue drivers seem to interfere. I’m assuming whatever the app is spitting out is plain text or something along the lines of HP PCL or Postscript.

Viewing 8 reply threads