Witilt 2.5 dropping samples

Hi, I have recently got my Witilt 2.5 talking to my OS X 10.5 machine via Matlab and the Psychtoolbox (support for serial comms in OS X version of matlab is poor but SerialComm or Comm seem to work).

I am able to stream Raw or G data successfully at 10Hz but if push the acquisition rate to as low as 50Hz I start to experience some dropout of data or what appears to be insertion of points. I assume that there is probably something wrong with my sampling in code.

Essentially I start the witilt streaming, then in a while loop (I acquire for 5 sec), then do a short while loop that waits for an acqusition rate sample, then purge the buffer, then read the buffer. See below

SerialComm(‘open’,port_num,‘57600,n,8,1’);

WaitSecs(2);

SerialComm(‘write’,port_num,‘1’);

start=GetSecs;

buffer=;

n=0;

while GetSecs-start<5

n=n+1;

s=GetSecs;

SerialComm(‘purge’,port_num);

while

GetSecs-s<(1/sample_rate);

end

d=SerialComm(‘read’,port_num);

time(n)=GetSecs-start;

buffer = [buffer d’];

end

SerialComm(‘write’,port_num,32);

SerialComm(‘close’,port_num);

Any comments appreciated.

Cheers

stu

It must be something with your code… because i have two witilt 2.5 units and i don’t have that problem…

Are you using matlab too?

KuRi:
It must be something with your code… because i have two witilt 2.5 units and i don’t have that problem…