View Single Post
  #27  
Old 02-24-2002, 03:11 PM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default input needed. VHO testing...

Hello,

Is it easy for you to build a cheap simple low speed ADC interface for the serial port? Matlab has serial access functions and the following code sample serve to illustrate how we can use our computers with a simple interface to do continuous data sampling.

Assuming that we want to take a sample every 60 seconds with a timing resolution of 'res':

% Code Snippet
res = 0.5;
previous_time = 0;
current_time = clock;

if [etime[current_time, previous_time) < 60)
pause[res);
current_time = clock;
else
previous_time = current_time;
% Trigger and sample ADC
current_time = clock;
end
% Code Snippet
Reply With Quote