Serial problems with visual studio 2005 pocket pc emulator

hi!!

I have to make a program which connects a pocket pc to another device by a serial port. I don't have a real pocket pc yet, so I'm using the visual studio 2005 emulator. The problem is that I cannot make the serial port work properly.

I map one serial port from the pc to the emulator, and it seems the emulator can open the port. The other pc serial port is monitored by hyperterminal. Both ports are connected by a null-modem cable.

at this point, the problems begin to arise:

1.- I can send characters by the port, but don't receive them at hyperterminal, only strange characters.

2.- The event DataReceived does not work.

Here is the code. Im using the class SerialConnector from the main form, jsut to make a test:
Does anybody have any idea

class SerialConnector
{
SerialPort serialPDAPort;
public event serialCharReceived onCharRx;

public void serialErrorReceived(object sender, SerialErrorReceivedEventArgs args)
{
onCharRx(this, 'E');
}

public void serialDataReceived(object sender, SerialDataReceivedEventArgs adrea)
{
onCharRx(this, (char)serialPDAPort.ReadChar());
}

public SerialConnector()
{
serialPDAPort = new System.IO.Ports.SerialPort("COM1",9600);
serialPDAPort.DataBits = 8;
serialPDAPort.ReceivedBytesThreshold = 1;
serialPDAPort.Parity = Parity.None;
serialPDAPort.StopBits = StopBits.One;
serialPDAPort.Handshake = Handshake.None;
serialPDAPort.ReadTimeout = 500;
serialPDAPort.WriteTimeout = 500;
serialPDAPort.DtrEnable = true;
serialPDAPort.RtsEnable = true;

}

public void open()
{
serialPDAPort.Open();
serialPDAPort.DataReceived += new SerialDataReceivedEventHandler(this.serialDataReceived);
serialPDAPort.ErrorReceived += new SerialErrorReceivedEventHandler(this.serialErrorReceived);
}

public void close()
{
serialPDAPort.Close();
}


public void sendChar(char charToSend)
{
serialPDAPort.WriteLine("somestring") ;
}
}


Answer this question

Serial problems with visual studio 2005 pocket pc emulator

  • ChrisMorley

    Unfortunately, even though the serial port emulation has been greatly improved in Emulator v2 (you are using v2, right ), it is still more reliable to use a real device

  • RickGaribay.NET

    Dear,

    I have the same communication problem with the serial door,
    But in case enters manually in HyperTerminal and to close HyperTerminal

    The application to works usually.

    Our they already go by that

    Thanks

  • Serial problems with visual studio 2005 pocket pc emulator