我需要帮助来制作示波器软件。我已经能够使用 winform 图表工具制作图表。这个应用程序从 USB 设备接收数据并将其绘制在图表中。我还使用表单更新器计时器控件来更新表单并从 USB 获取数据并将其绘制成图表。
private: System::Void FormUpdateTimer_Tick(System::Object^ sender, System::EventArgs^ e) {
if(ReadFile(ReadHandleToUSBDevice, &INBuffer, 65, &BytesRead, 0)) //Blocking function, unless an "overlapped" structure is used
{
//INBuffer[0] is the report ID, which we don't care about.
//INBuffer[1] is an echo back of the command (see microcontroller firmware).
//INBuffer[2] and INBuffer[3] contains the ADC value (see microcontroller firmware).
if(INBuffer[1] == 0x37)
{
data=(INBuffer[3] << 8) + INBuffer[2];
this->chart1->Series["Series1"]->Points->AddXY(k,data);
问题是表单每 1 毫秒更新一次。但我需要更快地执行表单来获取数据并快速绘制它。
updateTimer 不能取小于 1 毫秒的值。那么我怎样才能让这个应用程序快速执行呢?请帮忙!