Displaying Fast Data

dmccric 0 Reputation points

C# -> WPF -> .NET 6

Windows 10 64-bit, Visual Studio Community 2022 v17.9.2

I am writing a program in which I want to see the current from a 3-phase brushless DC Motor. Each phase will be displayed in a different colour to differentiate them. I have managed to get this to work to some extent.

I have a PIC32 MCU which sends a 57 byte data packet (8x16-bit value for each phase, 9 byte header) out at 115,200 bps, I send a full motor revolution of data and then skip 50 revolutions so the data rate is not ridiculous. The motor speed is 200 RPS.

My C# WPF program receives and parses this data very well but when I want to display the data using either LiveCharts or other program it slows down considerably, therefore I want to know if I can do this another way.


I create a serial class which I have a background worker thread receiving my data into a 5k byte buffer, the head.

Another background worker thread, the tail, will attempt to parse and decode the data and if the checksum is good then it will fire an event to store this data in a serialised class so it can be saved. The data is then marshalled in to the UI Thread so it can be displayed.

I was thinking of simply setting a separate thread on a timer which will display the data in chunks instead of .

If I simply do not display the data on a chart then I can receive over 10k data packets without a single bad packet.

The UI Thread chart seems to be the bottleneck, obviously.

Am I running to many threads on a single process?

Should I send more data in a single packet as displaying more data in one go might be more preferable to less data more often?

Any help is appreciated.


Microsoft Technologies based on the .NET software framework.
3,459 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,686 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,390 questions
{count} votes

1 answer

Sort by: Most helpful
  1. dmccric 0 Reputation points

    As I said, the parsing and decoding are fine with no bad checksums.

    Dispatching to the UI Thread to change the visual data is the bottleneck, I did not use the Dispatcher.InvokeAsync and I guess I will have to play around with the priority as well.

    I have seen programs display a hell of a lot more data than I am displaying and the responsiveness has still been good so one of these methods should get me there.

    Thanks for the reply.