Needs["CAN`"]
CanOuvrir["SysamSP5"]
CanConfigEntrees[{0,1},{5.0,10.0}]
CanConfigEchantillon[10.0,200]
CanDesactiverTrigger[]
CanAcquerir[]
tensions=CanEntrees[];
u=Table[tensions[[1]][[k]],{k,5}]
temps=CanTemps[];
t=Table[temps[[1]][[k]],{k,5}]
listeEA0=Table[{temps[[1]][[k]],tensions[[1]][[k]]},{k,1,Length[temps[[1]]]}];
ListPlot[listeEA0,AxesLabel->{"t (s)","U0 (V)"},Joined->False]
listeEA1=Table[{temps[[2]][[k]],tensions[[2]][[k]]},{k,1,Length[temps[[1]]]}];
ListPlot[listeEA1,AxesLabel->{"t (s)","U0 (V)"},Joined->False]
CanConfigTrigger[0,0.0,Montant->1,Pretrigger->10,PretriggerSouple->0]
CanAcquerir[]
tensions=CanEntrees[];
temps=CanTemps[];
listeEA0=Table[{temps[[1]][[k]],tensions[[1]][[k]]},{k,1,Length[temps[[1]]]}];
            
ListPlot[listeEA0,AxesLabel->{"t (s)","U0 (V)"},Joined->False]
CanConfigTriggerExterne[Pretrigger->10,PretriggerSouple->0]
CanAcquerir[]
tensions=CanEntrees[];
temps=CanTemps[];
listeEA0=Table[{temps[[1]][[k]],tensions[[1]][[k]]},{k,1,Length[temps[[1]]]}];
            
ListPlot[listeEA0,AxesLabel->{"t (s)","U0 (V)"},Joined->False]
Export["tensions1.dat",tensions,"Table"]
Export["temps1.dat",temps,"Table"]
            
tensions=Import["tensions1.dat","Table"];
temps=Import["temps1.dat","Table"];
            
n=1000;
s1 = Table[N[Sin[2*Pi*k/n] + 0.5*Sin[4*Pi*k/n]], {k, 0, n}];
            
s2 = Table[N[1.0*k/n], {k, 0, n}];
            
CanConfigSortie[1, 10.0, s1, 1]
CanConfigSortie[2, 10.0, s2, 1]
            
CanDeclencherSorties[1, 1]
Pause[5]
CanStopperSorties[1,1]

te = 10.0;
n = 1000;
s1 = Table[N[Sin[2*Pi*k/n]+0.5*Sin[4*Pi*k/n]], {k, 1, n}];
CanConfigEntrees[{2}, {10.0}]
CanConfigEchantillon[te, n]
CanDesactiverTrigger[]
CanAcquerirAvecSorties[s1, {}]
tensions = CanEntrees[];
temps = CanTemps[];
listeEA2 = Table[{temps[[1]][[k]], tensions[[1]][[k]]}, {k, 1, Length[temps[[1]]]}];
            
ListPlot[listeEA2,AxesLabel->{"t (s)","U2 (V)"},Joined->False]
CanConfigEntrees[{0, 1}, {5.0, 10.0}]
CanActiverLecture[{0, 1}]
            
y=CanLire[]
liste = {};
For[i = 0, i < 5, i++,
 	liste = Append[liste, CanLire[]];
 	Pause[5];
 ]
liste
            
CanDesactiverLecture[]
CanEcrire[1,2.0,1,0.0]
CanFermer[]
