function aa=gyroj(rscom1)
d=[];
dd=[];
aa=zeros(1,9);
while(1)
  for i=1:10000
        readasync(rscom1);
		if rscom1.BytesAvailable > 20-1,
            d = fread(rscom1,rscom1.BytesAvailable);
            break;
        end
  end
  if i == 10000
      fprintf('warning time out\n');
      aa=zeros(1,9);
      return;
  end
  for e=1:length(d)
   if(d(e)>127) dd=d(e);
   else 
     dd=[dd d(e)];
     if(length(dd) == 20) break;end
     if(length(dd) > 20) dd=[];end
   end
  end
  if(length(dd) == 20) break;end
end
if sum(dd(2:end)>127) == 0
aa=dd(4:2:20)*512+dd(3:2:19)*4;
aa=(aa-(aa>2^15)*2^16)./[10000 10000 10000 100 100 100 65536/360 65536/360 65536/360];
else
      fprintf('data error\n');
      aa=zeros(1,9);
end

