Com0Com

For the uninitiated: Framework 2.0 nowadays sports genuine Serialport communication (via an extra class/component called SerialPort) [MSDN link]. The class supports both blocking and non-blocking forms of communication.

A good way to test serial port communication (without the need of plugging hardware to your serial port, that is if you have one1) is by using a virtual serial port driver. A fairly good one is the (open-sourced) com0com driver, which you can find around this area. If you’re not used to poking around the registry, here a brief outline of how to install the driver under Windows XP (tested on both Home/Professional editions):

  1. Download the driver (you can also download the sources if you wish)
  2. Unzip the driver to the folder.
  3. Launch the ‘Add Hardware wizard’.
  4. ‘Have you already connected your bla-bla’ – Yes, Next.
  5. From the installed hardware list, scroll down and select ‘Add a new hardware device’.
  6. ‘Install the hardware that I manually select from a list’.
  7. ‘Select all devices’ (this takes a while)
  8. ‘Select Standard port types’ – ‘Communications Port’.
  9. Select ‘Have Disk’, go to folder and select the com0com.inf file.
  10. At this stage Windows will add to try 2 extra com ports CNCA0 and CNCB0. It will ask to install the hardware. FOLLOW THE INSTRUCTIONS AND DON’T PRESS CANCEL. Remember, two ports are supposed to be added.
  11. When done, it’s time to rename the ports. C# doesn’t like silly names for COM ports, so check your hardware list and find out which port numbers are still available. Add these ports to the registry (as described in the readme file). We at xsamplex made it easier for you, of course. You can copy and paste the following fragment to a file (save with .reg extension). Once again, choose the portnumber of your liking:
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\
    Services\\com0com\\Parameters]
    
    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\
    Services\\com0com\\Parameters\\CNCA0]
    "PortName"="COM5"
    
    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\
    Services\\com0com\\Parameters\\CNCB0]
    "PortName"="COM6"
    

    (Note: Remove extra line breaks after CurrentControlSet key)

  12. Restart your computer.
  13. Do a test using two Hyperterminals: connect one to COM 5 and the other to COM 6.

And that’s it!

1 Most laptops might not even come with a serial com port…

This entry was posted in Ordinateurs, Programming. Bookmark the permalink.