% DAQ Toolbox demonstration program % % by Robert W. Ives, USNA % based on the daqdemo program by: % Thad B. Welch, CDR USN % 28 July 1999 % % To start the program type "daq_minidemo" and push the "Enter" button. % A pause will then execute. To continue, push the "Enter" button again. % To stop the program hit the CTRL-C buttons. % The cpu may NOT be capable of processing the 8-44.1 ksamples/sec gathered % by the DAQ system. Therefore, this program is intented for SHORT TERM % OPERATIONS ONLY! Failure to to adhere to this warning may result in % a system crash or an excessive program shutdown time. % fs=8000; % sample frequency (in Hz) N=512; % number of samples grabbed w/each data acquisition data=zeros(N,1); % set aside space for N values AI=analoginput('winsound'); % "AI" is the daq object, taken from the analog input set(AI,'SampleRate',fs); % set the sample rate of AI chans=addchannel(AI,1); % add a hardware channel input to provide data to AI set(AI,'SamplesPerTrigger',N); % take a group of N samples with every trigger set(AI,'TriggerRepeat',inf); % keep on triggering forever start(AI); % start the data acquisition object while AI.SamplesAcquired