Split GPS COM Ports using com0com and hub4com

By | November 19, 2015
Share

Here is a script I wrote to split GPS COM ports to multiple virtual COM ports.  In this

  • Create virtual COM ports 14 and 15 using com0com (Used a high number to avoid hitting a conflict with an existing port).

Download link: https://code.google.com/p/powersdr-iq/downloads/detail?name=setup_com0com_W7_x64_signed.exe&can=2&q=

start /w "" "%~dp0setup_com0com_W7_x64_signed.exe" /S

cd /d "C:\Program Files (x86)\com0com"
setupc.exe install 0 - PortName=COM14,EmuBR=yes
setupc.exe change CNCA0 EmuBR=yes
setupc.exe change CNCA0 HiddenMode=yes
setupc.exe install 1 - PortName=COM15,EmuBR=yes
setupc.exe change CNCA1 EmuBR=yes
setupc.exe change CNCA1 HiddenMode=yes
  • 2. Locate assigned GPS Com port.

Download link: http://www.pcre.org/current/doc/html/pcre2grep.html

wmic PATH Win32_PnPEntity Where (Name LIKE '%%NMEA%%' or Name LIKE '%%GPS%%') get Name | "%~dp0pcre2grep.exe" -e "COM[0-9]{1,3}" -o>"%temp%\COMPORT.txt"
SET /P COMPORT=<%temp%\COMPORT.txt
  • Use hub4com to span GPS port to 2 virtual COM ports.

Download link: http://sourceforge.net/projects/com0com/files/hub4com/

copy /Y "%~dp0hub4com.exe" "C:\Program Files (x86)\com0com\"

cd /d "C:\Program Files (x86)\com0com"
hub4com --baud=9600 --route=0:All \\.\%COMPORT% \\.\CNCA0 \\.\CNCA1

Lastly, copy a start hub4com batch file to to the Windows startup to force hub4com to start on Windows login.

copy /Y "%~dp0RunAsSvc.exe" "C:\Program Files (x86)\com0com\"

copy /Y "%~dp0Start hub4com.bat" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

/Brian G

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.