Index: branch/tronel_florian/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tronel_florian/Emb_App/programme_principal_etud.c	(revision 267)
+++ branch/tronel_florian/Emb_App/programme_principal_etud.c	(revision 268)
@@ -109,14 +109,9 @@
 //'I'/73/Ox49 : D?finition du nom du v?hicule. Doit d?buter par le caract?re '#' et entraine le chargement de la configuration de piste
 //                                correspondant au nom du v?hicule si le nom se termine par '*'
 
-void depart();
    
-//Variable contenant l'angle souhait?
-int Ang_s=-300, Ang_o, vit_s=20;
-//Variable contenant la vitesse angulaire, vitesse et angle des roues
-int v_tourelle, vit, ang_r, dist;
-//Gain de la r?gulation
-int k=10;
+int dist;
+int ang_r;
 
 
 void main()
@@ -123,79 +118,87 @@
 {       ports_mcu();
     	lcd_init();
         periph_init();
-        periph_nom("#AutoTest*");
+        periph_nom("#Flo*");
     	can_init();
     	clavier_init(1);
         capture_init();
 		
-		//depart();
+		sta_tsk(ID_periph_rx);
 		
-		//sta_tsk(ID_depart);
-		//dly_tsk(2000);
+		sta_tsk(ID_task_1);
+		sta_tsk(ID_task_2);
+		sta_tsk(ID_task_3);
+		sta_tsk(ID_task_4);
 		
-		sta_tsk(ID_tourelle);
-		sta_tsk(ID_telemetre);
-		sta_tsk(ID_angle_roue);
+		
 		//sta_cyc(ID_acqui);
-		//sta_tsk(ID_periph_rx);       
-		while(1){periph_write('V',1);}
+		       
 }
-  
-/*
-void depart(){
-		CanFrame dep;
-		
-		dep.data.id='V'; 
-    	dep.data.rtr=0; 
-    	dep.data.val=50;
-		
-	    snd_dtq (CanTx,dep.msg);
-		//dly_tsk(2000);
-}
-*/
 
-void telemetre(){
-	CanFrame t, ret;
+void task_1(){
+	/*CanFrame vit_1={{'V',0,5}};
+	snd_dtq(CanTx,vit_1.msg);
+	
+	dly_tsk(80);
+	*/	
 	while(1){
-	t.data.id='U';
-	t.data.rtr=1;
-	snd_dtq(CanTx,t.msg);
+		CanFrame vit_2={{'V',0,20}};		
+		snd_dtq(CanTx,vit_2.msg);
+		dly_tsk(80);
+	}
 	
-	rcv_dtq(CanRx, &ret.msg);
+}
 	
-	dist=ret.data.val;
-	dly_tsk(3);
-	}	
-}
+void task_2(){
+CanFrame req_1, rep, cons_tourelle;
+int ang_o, vit_t, ang_s=450;
 
-void angle_roue(){
 	while(1){
-	ang_r= 1000-dist;
-	periph_write('D',ang_r);
-	dly_tsk(3);
+		req_1.data.id='R';
+		req_1.data.rtr=1;
+		snd_dtq(CanTx,req_1.msg);
+		
+		//rcv_dtq(CanRx,&rep.msg);
+		ang_o = periph[ADDR('R')].val;
+		
+		vit_t=3*(ang_s - ang_o);
+		
+		cons_tourelle.data.id='T';
+		cons_tourelle.data.rtr=0;
+		cons_tourelle.data.val=vit_t;
+		
+		snd_dtq(CanTx,cons_tourelle.msg);
+		dly_tsk(2);	
 	}
-}
+} 	
 
-void tourelle(){
+void task_3(){
+CanFrame req_2;
+
+	while(1){
+	req_2.data.id='U';
+	req_2.data.rtr=1;
+	snd_dtq(CanTx,req_2.msg);
 	
-	CanFrame r, rep;
+	//rcv_dtq(CanRx,&rep.msg);
+	dist = periph[ADDR('U')].val;
 	
+	if(dist>1200){dist = 700;}
+	dly_tsk(3);		
+	}	
+}
+ 
+void task_4(){
+CanFrame cons_roue;
+
 	while(1){
-		
-	r.data.id='R';
-	r.data.rtr=1;
+	ang_r=1*(dist-700);
 	
-	//on envoie une requête pour la lecture de notre angle		
-	snd_dtq(CanTx,r.msg);
-	//on recupère cette valeur 
-	rcv_dtq(CanRx, &rep.msg);
-	//on la copie dans un "unsigned short" pour pouvoir la lire avec un point d'arrêt
-	Ang_o=rep.data.val;
+	cons_roue.data.id='D';
+	cons_roue.data.rtr=0;
+	cons_roue.data.val=ang_r;
 	
-	v_tourelle=k*(Ang_s-Ang_o);
-	periph_write('T',v_tourelle);
-	dly_tsk(3);
-	}
-	
-}
-
+	snd_dtq(CanTx,cons_roue.msg);
+	dly_tsk(3);		
+	}	
+} 
Index: branch/tronel_florian/Emb_App/conf_noyau.cfg
===================================================================
--- branch/tronel_florian/Emb_App/conf_noyau.cfg	(revision 267)
+++ branch/tronel_florian/Emb_App/conf_noyau.cfg	(revision 268)
@@ -39,7 +39,7 @@
 	name	= ID_main;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 8;
+	priority	= 6;
 	initial_start	= ON;
 	exinf	= 0x0;
 };
@@ -48,7 +48,7 @@
 	name	= ID_periph_tx;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 3;
+	priority	= 1;//3
 	initial_start	= ON;
 	exinf	= 0x0;
 };
@@ -57,51 +57,51 @@
 	name	= ID_periph_rx;
 	stack_size	= 256;
 	stack_section	= stack;
+	priority	= 1;//2	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+//vitesse de la voiture
+task[]{
+	entry_address	= task_1();
+	name	= ID_task_1;
+	stack_size	= 256;
+	stack_section	= stack;
 	priority	= 2;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
-
+//asservissement de la tourelle
 task[]{
-	entry_address	= tourelle();
-	name	= ID_tourelle;
+	entry_address	= task_2();
+	name	= ID_task_2;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 1;
+	priority	= 2;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
-
+//acquisition de la distance
 task[]{
-	entry_address	= angle_roue();
-	name	= ID_angle_roue;
+	entry_address	= task_3();
+	name	= ID_task_3;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 1;
+	priority	= 2;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
-
+//asservissement angle roue
 task[]{
-	entry_address	= telemetre();
-	name	= ID_telemetre;
+	entry_address	= task_4();
+	name	= ID_task_4;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 1;
+	priority	= 2;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
-//task[]{
-//	entry_address	= depart();
-//	name	= ID_depart;
-//	stack_size	= 256;
-//	stack_section	= stack;
-//	priority	= 1;
-//	initial_start	= OFF;
-//	exinf	= 0x0;
-//};
-
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
