C# – How to test serial / Hyperterminal integration with C#


I have to develop software for a USB scale that, when you press a button on it, sends serial communications over USB. I can see the values in HyperTerminal.

I am going to use the .NET classes for Serial communication to trap the data.

The problem is, I don't have the scale. The scale is connected to a remote computer I can RDP into. When I want to test, I can ask the client to press the button on the scale.

I can't ask the client to press the button 100 times a day, I need to have a way to develop with a reasonably good idea of what the scale will report, and only test when I think I have a solution.

I'm looking for something locally, that can mimic the scale and send to my .NET Serial classes, the same output as the scale. Ideally, if I could record the scale's data, and then play it back on another machine, it would be perfect.

How would I do this?

Best Solution

1) Abstract away your communications code. In test mode, feed your logic function from a data file stream rather than the serial stream.


2) If you have 2 serial ports (or two pcs), then setup a scale emulator app that talks out thru one port, and plug that into the other port where your software is running.