could BytesAvailable in serial-comm be wrong?

2 ビュー (過去 30 日間)
Luca Cavazzana
Luca Cavazzana 2012 年 1 月 11 日
I'm reading a three-channeled signal from the serial port (an emg signal at 240Hz, if you are curious). The problem it happens (not very often, but happens) that the fscanf outputs a broken sample: missing channels, repeated dividing characters,...
Could it be the problem is I'm reading in a bad moment, for example when data is written in the buffer but BytesAvailable not yet updated (or vice versa) so what I'm reading is the overlapping of the new set of samples and an older one in the dirty buffer? (that would mean the write of the serial-buffer and the update of byte count is not atomic).
Before claiming the electromyogram is glitched I want to rule out all other possibilities.
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 1 月 11 日
Do you have hardware flow control set on? If not then it would be a good idea.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by