Serial Data with no TimeOut - Callback on read?

3 ビュー (過去 30 日間)
Jonathan
Jonathan 2012 年 9 月 28 日
Hello all, I've been using ML to communicate with meters and motors through serial ports. The goal is to take serial data from a meter into ML, perform some operations on it, and shoot a command out to a motor drive. The issue that comes into play is getting the serial data in. fscanf() works just fine, but if the meter isn't sending data at the same rate that I'm polling the buffer then I either get old data or a timeout.
Is it possible to set up a real-time scan such that as soon as data comes in it passes it through (like a callback) and otherwise it just waits? It would be especially great if the software could run normally while scanning as well, rather than just not having a timeout and still stalling out the rest of the software.
I'll keep looking, but I hope someone has an idea!

採用された回答

Jonathan
Jonathan 2012 年 12 月 18 日
Solution found using BytesAvailableFcn awhile back, forgot to update the question.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Acquisition Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by