Windows Embeded CE 6.0 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Windows Embeded CE 6.0

drkidd22drkidd22 Posts: 2Member

I'm new to programming for Windows CE. I have made a simple application that open up a COM port and it's supposed to receive commands. The port is setup as a loopback for testing right now. It runs fine in Windows 7 Machine, but when I try to run the .exe on the Windows CE platform it spits out a few errors when it tries to open up the com port.

I wrote the application with C# in Visual Studio Pro 2005. If someone can give me a hint I'll appreciate it. I build as a Windows CE 5.0 Device on the IDE.

Below is my code in C#:

[code]using System;
using System.IO.Ports;

namespace COMTest
public class Program
static bool _continue;
static SerialPort _sPort;

public static void Main(string[] args)
string _portList;

//Configure the COM Port
_sPort = new SerialPort();
_sPort.PortName = "COM2";
_sPort.BaudRate = int.Parse("9600");
_sPort.Parity = (Parity.None);
_sPort.DataBits = int.Parse("8");
_sPort.StopBits = (StopBits.One);

_sPort.ReadTimeout = 500;
_sPort.WriteTimeout = 500;

_portList = SetPortName("COM2"); //Check for availaable COM Ports and lists them.

_continue = true;

//tesString = Console.ReadLine();
_sPort.WriteLine("COM PORT TEST");
_sPort.WriteLine("Type String to LoopBack");


public static void Read()
while (_continue)
string message = _sPort.ReadLine();
catch (TimeoutException) { }

public static string SetPortName(string defaultPortName)
string portName;

Console.WriteLine("Available Ports:");
foreach (string s in SerialPort.GetPortNames())
Console.WriteLine(" {0}", s);

Console.Write("COM port({0}): ", defaultPortName);
portName = Console.ReadLine();

if (portName == "")
portName = defaultPortName;
return portName;

Sign In or Register to comment.