1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Virtual UART in windows (C#)

Discussion in 'Microcontrollers' started by misterT, Sep 29, 2017.

  1. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I have a sensor. It works fine and sends data through uart. I also have an application to log all kinds of data in a particular format.

    The data format from the sensor is not compliant with the data logger. So I need an "adapter softare" to read the data from the sensor, convert it, and send it to the logger. All communication is through uart. Is there an easy method to create a virtual com-port in windows. The goal is that the application receives the data from the sensor, converts it, and then sends the data to the logger through a virtual com-port.

    Or, should I just build a "null-modem cable" using two usb-uart cables?
     
  2. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    I use this application extensively for serial port emulation - my laptop at work has exactly zero serial ports and often I'll use this to create two ports and emulate a whole end to end control system on the same laptop works great in virtual machines too ......

    http://www.eterlogic.com/Products.VSPE.html
     
    • Like Like x 1
  3. HDowns

    HDowns New Member

    Joined:
    May 16, 2012
    Messages:
    3
    Likes:
    1
    • Like Like x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE

    I used to use com0com from the sourceforge site, but It doesn't work with win 8 or win 10 because of the fees Microsoft put into place for certificates to work... The cheapest one seems to be the one HDowns has linked in..
     
    • Like Like x 1
  6. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I think I use two usb to uart cables and make my own "null-modem cable". And then stick both ends of that in the same computer.
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    That's how I do it..

    BTW I have dropped C# and I now use Lazarus.. It's easier to make interfaces.... The serial modules are really good... I found the com structure used by C# difficult to use.. MIND!!! If you do use Lazarus, it doesn't autosave and Win10 doesn't ask when updating... Lost hours of programming that way...
     
  8. HDowns

    HDowns New Member

    Joined:
    May 16, 2012
    Messages:
    3
    Likes:
    1
    I'm using this method on my desktop too, but in some cases a software solution is better (laptops with 1-2 USB ports, several serial connection at the same time).
     
  9. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    My "Null modem" cable has two FTDI chips back to back so I can use com3 and com4
     

Share This Page