从串口读取数据并以图形形式连续显示
问题描述:
我打算做一个监控程序.该程序将能够不断从硬件捕获温度读数.我将需要从串行端口或USB端口接收数据,并以图形的形式连续显示.并具有按钮Save&打开.
请帮助!提前谢谢.
图片 [^ ]
I plan to do a monitoring program. The program will be able to capture temperature reading constantly from hardware. I will need to receive data from the serial port or usb port and present it continuously in graph. and have button save & open .
Pls help! Thanks in advance.
pic[^]
答
请参阅我的回答
从串行端口读取数据 [ ^ ]
从中,您将获得输入/输出数据并将其显示为图形.
谢谢.
See My answer at
Reading Data from Serial Port[^]
From it you will get the data Input/Output and show it to graph.
Thanks.
就这样.
这闻起来很像您的作业,所以没有代码!
您将需要:
SerialPort类实例:处理已接收数据 [ ^ ]事件和从传感器格式转换为实际温度.
存放它的地方:我建议使用列表类 [
So do it.
This smells strongly of your homework, so no code!
You will need:
A SerialPort class instance: handle the DataReceived[^] event and convert from sensor format to actual temperature.
Somewhere to store it: I would suggest a List class[^] - what type you put in the list depends on what kind of temperatures you receive from the sensor. I would suggest your own class, so that you can timestamp each temperature, to help with charting them.
A Chart control to display it (MS provide one if you aren''t going to make your own - Google will help you find it.
Buttons, and code to save and load - again this will depend on what your values look like.