exec(SCI+"\contrib\can\loader.sce",-1)
CanOuvrir("SysamSP5")
CanConfigEntrees([0,1],[5.0,10.0])
CanConfigEchantillon(10.0,200)
CanDesactiverTrigger()
CanAcquerir()
tensions=CanEntrees();
u0=tensions(1,:);
u1=tensions(2,:);
                
y=u0(1:5)
temps=CanTemps();
t=temps(1,:);
figA=scf();
plot2d(t,u0,rect=[0,-1,0.002,1],style=2);
xtitle('','t (s)','u0 (V)');
                
figB=scf();
plot2d(t,u1,rect=[0,-10,0.002,10],style=2);
xtitle('','t (s)','u1 (V)');
                
CanConfigTrigger(0,0.0,%T,10,%F)
CanAcquerir()
tensions=CanEntrees();
temps=CanTemps();
u0=tensions(1,:);
t=temps(1,:);
            
figC=scf();
plot2d(t,u0,rect=[0,-1,0.002,1],style=2);
xtitle('','t (s)','u0 (V)');
                
CanConfigTriggerExterne(10,%T)
CanAcquerir()
tensions=CanEntrees();
temps=CanTemps();
u0=tensions(1,:);
t=temps(1,:);
            
figD=scf();
plot2d(t,u0,rect=[0,-1,0.002,1],style=2);
xtitle('','t (s)','u0 (V)');
                
save("\users\fred\documents\scilab\electro\tensionsA.dat",tensions,temps)
clear tensions
clear temps
load("\users\fred\documents\scilab\electro\tensionsA.dat","tensions","temps")
figE=scf();
plot2d(temps(1,:),tensions(1,:),rect=[0,-1,0.002,1],style=2);
xtitle('','t (s)','u0 (V)');
                
n=1000;
t=linspace(0,10*%pi,n);
us1=2.0*sin(t)+1.0*sin(2*t);
us2=2.0*cos(t);
            
CanConfigSortie(1,10.0,us1,1)
CanConfigSortie(2,10.0,us2,1)
            
CanDeclencherSorties(1,1)
te=10.0
n=1000;
CanConfigEntrees([2],[5.0])
CanConfigEchantillon(te,n)
t=linspace(0,10*%pi,n);
us1=2.0*sin(t)+1.0*sin(2*t);
CanDesactiverTrigger()
CanAcquerirAvecSorties(us1,[])
            
tensions=CanEntrees();
u2=tensions(1,:);
temps=CanTemps();
t=temps(1,:);
            
figF=scf();
plot2d(t,u2,rect=[0,-5,n*te*1e-6,5],style=2);
xtitle('','t (s)','u2 (V)');
                
CanConfigEntrees([0,1],[5.0,10.0])
CanActiverLecture([0,1])
y=CanLire()
        
realtimeinit(5.0)
realtime(0)
n=5
M=zeros(2,n);
for k=1:n,
    realtime(k);
    M(:,k)=CanLire();
end;
M
        
CanDesactiverLecture()
CanEcrire(1,2.0,1,0.0)
CanFermer()
