Path: news.mathworks.com!not-for-mail
From: "Dave Hathaway" <david.hathaway@aecom.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: DAQ SamplesAvailable never >0 after getdata
Date: Wed, 10 Feb 2010 14:26:04 +0000 (UTC)
Organization: AECOM
Lines: 32
Message-ID: <hkufls$802$1@fred.mathworks.com>
References: <hks0ii$p3$1@fred.mathworks.com> <hkuaq8$mhm$1@fred.mathworks.com>
Reply-To: "Dave Hathaway" <david.hathaway@aecom.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1265811964 8194 172.30.248.37 (10 Feb 2010 14:26:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 10 Feb 2010 14:26:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1931390
Xref: news.mathworks.com comp.soft-sys.matlab:606116


"Sherryl Radbil" <sherryl.radbil.dontspamme@mathworks.com> wrote in message <hkuaq8$mhm$1@fred.mathworks.com>...
*snipped*
> As long as you've set the acquisition to go as long as you need either via SamplesPerTrigger or TriggerRepeat and started this should work.
> All the best,
> Sherryl

Thanks Sherryl,

I think I found the problem.

ai = analoginput('winsound', 0);
addchannel(ai, 1:2);

set(ai, 'SampleRate', 5000);
set(ai, 'SamplesPerTrigger', 5000);
set(ai, 'TriggerRepeat', inf);
set(ai, 'TriggerType', 'manual');
set(ai, 'TimerFcn', @localtimer_callback);
set(ai, 'TimerPeriod', 0.5);  
set(ai, 'BufferingConfig',[5000*2,20]);
set(ai, 'SamplesAcquiredFcn', @localacquired_callback);
set(ai, 'SamplesAcquiredFcnCount', 5000);
start(ai);
trigger(ai);

All the examples had the TriggerRepeat value as 1.  Then they would use peekdata to grab samples without actually exhausting that 1.  When I set the value to 'inf', it started filling the buffer non-stop.

I hope this solves my problem.  I'm not sure what of the above I really need, but I have a start towards development.  Any thoughts are appreciated.

Thanks again,

Dave