Search code examples
c#serial-portemulationsimulationcom0com

C# serial port, simulation of serialport write


I have a c# app that connects pc to a device, through a serial port.

When I send data to the device, if the device sends data back, the datareceived event fires.

And I want to ask this. Is there a way to simulate the data sending of the device?

I mean, i want to fire datareceived event not only when the device send data.

Is this possible?


Solution

  • You must have an additional free serial port.

    If need be, you may:

    • just add another new one or
    • install a virtual COM port solution (such as com0com).

    You can harness your C# program using a software emulator of the device through Null modem.