Filter löschen
Filter löschen

Receive data from COM

2 Ansichten (letzte 30 Tage)
lafe
lafe am 22 Nov. 2016
Bearbeitet: lafe am 23 Nov. 2016
I am trying to make a code that will read data from a COM (in my case TCP/IP connection) every time that the data appears without using an infinite loop or without determining how many times the loop will happen. I’m expecting to receive packets with deferent size. Till now I have only accomplice to receive data with this code:
while 1
len = s1.BytesAvailable; % wait to receive a new character
while len == 0
len = s1.BytesAvailable;
end
in = fread(s1,1);
fprintf('\n 1character received %d',in)
end
any help please?

Antworten (0)

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by