Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!y42g2000hsy.googlegroups.com!not-for-mail
From:  "G.A.M." <x0Zero@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Need both modes of BytesAvailableFcnMode at the same time
Date: Sun, 23 Sep 2007 02:17:15 -0000
Organization: http://groups.google.com
Lines: 27
Message-ID: <1190513835.238939.231600@y42g2000hsy.googlegroups.com>
NNTP-Posting-Host: 24.129.101.179
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1190513835 22386 127.0.0.1 (23 Sep 2007 02:17:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 23 Sep 2007 02:17:15 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: y42g2000hsy.googlegroups.com; posting-host=24.129.101.179;
Xref: news.mathworks.com comp.soft-sys.matlab:429759



The data sent back from my instrument are of two types:
1. short codes under 20 bytes containing status info
2. data over 1000 bytes

The data is not terminated with any special character. However, I
believe all the status codes are terminated with a decimal value of 13
(carriage return).

In order to be notified of the status codes and the data, I have been
using these definitions:
'BytesAvailableFcnMode','byte',...
'BytesAvailableFcnCount',5,...

With those I'm sure to be notified of any status codes, but when I
actually get data, the BytesAvailableFcn is called over 200 times for
one buffer of data.

I'm sometimes getting some hard to diagnose errors in the following
line in my instrument callback:
feval(val{1}, obj, eventStruct, val{2:end})

I'm thinking it may be due to the above BytesAvailableFcn issue when
multiple data buffers are sent close together.

Can anyone suggest a better solution for reading my serial data?
Thanks. I appreciate any suggestions.