%DAQ.M - DATA ACQUISITION OF 512 POINTS
while 1,                      %loop continuously
!daq                          %execute data acquisition program
load daq.dat;                 %load file with 512 sample points
plot(daq);                    %plot samples using Matlab
pause                         %wait for a key
R1=fft(daq,512);              %512-point FFT using Matlab
P1=abs(R1)/512;               %take magnitude
fs = 44640;                   %Fs same as in DAQ.ASM for DSK
f=[0:fs/512:fs-fs/512];       %frequency axis between 0 - Fs 
plot(f(1:256),P1(1:256));     %plot FFT between 0 - Fs/2 
title('Frequency Spectrum');  %plot title
pause                         %wait for a key
end                           %loop back


