开发者

How to draw digital datas as a continuous signal in C#?

开发者 https://www.devze.com 2023-03-06 06:18 出处:网络
I am dealing with a project and for now I can get analog signals from my sensors and with PIC\'s ADC, convert them to digital datas. Besides, via USB I can transfer all the datas to my windows applica

I am dealing with a project and for now I can get analog signals from my sensors and with PIC's ADC, convert them to digital datas. Besides, via USB I can transfer all the datas to my windows application (user interface) which is made by C#. When I look into my inputbuffer, all the datas there.

  1. My problem is after these steps, how can I draw these datas as a continuous signal? I use ZedGraph and I want to observe my sensor datas as a continuous signal. I know how to draw something using ZedGraph. I even drew my inputbuffer only one time. But still I cannot manage it as a continuous signal.

  2. Which architecture is more suitable for me? Should I use circular buffer?

  3. Can I use PerformanceCounter class as my custom events such as drawing my sensor datas or this class is only useful for system events? 开发者_运维技巧


You could create a Performance Counter, that is easy to do.

Drawing the graph yourself is a bit harder:

  1. (I take it you mean by continuous signal a line instead of points) Just draw a line from the previous position to the current position.

  2. A circular buffer might help (although the oldest data should shift back in I think) but you still need to keep track of the previous position so you know how to draw the line. Make sure you shift the buffer in proportion to the time elapsed.

  3. An alternative would be to be to push the data to an Excelsheet and use the charts there.


Can't you just assign a timestamp to each data point in your sample? Then you should be able to easily plot the sample using time as X-axis and value as Y-axis with zed-graph, only need to adjust some parameters like line smoothing etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消