Emulating error on using COM ports

I am using the EMX10-SM-128 module.
My question is that COM2, COM3, COM4 did not worked in emulator, but COM1. Virtual serial Port Emulator (VSPE) runs at my PC. I am listening the ports with Realterm data terminal. The codes testing the COM ports in emulator is given below. COM1 has been emulated, but when I changed COM1 to others i.e. COM3, they did not. I have deployed the code to the module with the “COM3”, it worked.
is it emulator problem? or is there any other modification?

using System;
using System.Text;
using System.IO.Ports;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace MFConsoleApplication4
    public class Program
        public static void Main()
            int k = HardwareProvider.HwProvider.GetSerialPortsCount();
            //            Debug.Print(k.ToString());

            byte[] rx_Bytes = new byte[50];
            byte[] tx_Bytes = new byte[50];
            string read_Data1, send_Data1;

            SerialPort UART_port = new SerialPort("COM3", 19200);

            UART_port.Parity = Parity.None;
            UART_port.StopBits = StopBits.One;

            UART_port.ReadTimeout = 100;
            UART_port.WriteTimeout = 100;

            while (true)
                    int read_Count = UART_port.BytesToRead;

                    if (read_Count > 0)
                        UART_port.Read(rx_Bytes, 0, read_Count);

                        char[] chars = new char[read_Count];

                        chars = Encoding.UTF8.GetChars(rx_Bytes);
                        System.String rxS = new System.String(chars);
                        read_Data1 = rxS.ToString();
                        read_Data1 = null;
                    send_Data1 = read_Data1 + "-> received" + "\r\n";

                    tx_Bytes = System.Text.Encoding.UTF8.GetBytes(send_Data1);

                    UART_port.Write(tx_Bytes, 0, send_Data1.Length);


                catch (Exception ex)


Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)

I believe that only one serial port is supported in the emulator.

There is another problem, that is the value of k is given as 2 in emulator. In fact it must be 4 since the module has 4 COM ports.

Change the configuration file, and it should work. I have done it before, I can’t remember where it is. :slight_smile:

In my project, I am planning to use more than one port. So it would be better to simulate all ports at the same time.

few people customise the emulator, so you’re somewhat alone on exploring this. Not totally alone and in the dark, but you only have a small torch that has a dodgy battery. Good luck on the hunt