% 
channel=get(ui(12),'value');
% check interval(depend on channel)
interval=get(ui(6),'value');
mininterval=channel/100000;
if(interval < mininterval) interval=mininterval;end;
if(interval >= 1048576/1e7) interval = 1048576/1e7;end;
set(ui(6),'min',mininterval);
set(ui(6),'value',interval);
set(ui(7),'string',num2str(interval));
% check datnum( depend on channel)
maxdatnum = round(16384/channel);
datnum=round(get(ui(9),'value'));
if(maxdatnum < datnum) datnum = maxdatnum;end;
set(ui(9),'max',maxdatnum);
set(ui(9),'value',datnum);
set(ui(10),'string',num2str(datnum));
gain=get(ui(17),'value');
if(gain <1) gain = 1;end;
if(gain > 200) gain = 200;end;
set(ui(17),'value',gain);
set(ui(18),'string',num2str(gain));
freqmode=get(ui(4),'value');
ac_dc=get(ui(20),'value');
delete(pp);delete(cgca);
data=adpcmcia(interval,datnum,channel,ioaddr,0);
if(freqmode==1) 
data=abs(fft(data))/datnum*2;
pp=plot((ac_dc+1:round(datnum/2))/interval/datnum,data(ac_dc+1:round(datnum/2),:));
axis([0 1/2/interval 0 10/gain]);
else pp=plot((1:datnum)*interval,data);
axis([0 datnum*interval -10/gain 10/gain]);end;
cgca=gca;
set(cgca,'position',[0.2 .12 .75 0.815]);
set(cgca,'drawmode','fast');
set(pp,'erasemode','xor');
