control the cursor by joystick with pyschtoolbox and daq. Delay in refresh rate?

I am writing a matlab script to control the display of cursor using the joystick. The joystick is interfaced with PC via NI USB card.

Everything seems to be fine, but there are a 15ms delay in the refresh rate of Psychtoolbox (thus makes the cursor all the screen seems to vibrate a little). Is the method of collecting data below correct?

Here is the skecth of my code:

Initalize the daq and position of the cursor on the screen.

ai = analoginput(adaptor,id);
addchannel(ai,chanID);
addchannel(ai,chanID2);
set(ai, 'SampleRate', sampleRate);
set(ai, 'SamplesPerTrigger', 100);


while(not yet period of the experiment)
{

start(ai);//collect data from daq,
Change = (getdata(ai, 1)-initialPosX) * speed;
x_Change = Change(2)* -1;
y_Change = Change(1)*-1;
stop(ai);
% UPDATE DATA
dataX = round(80 * xChange);
dataY = round(50 * yChange);
//draw to screen

}

Thanks for your help!