Index: branch/tchuem/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tchuem/Emb_App/programme_principal_etud.c	(revision 400)
+++ branch/tchuem/Emb_App/programme_principal_etud.c	(revision 401)
@@ -123,9 +123,11 @@
 
 float C=600;
 float Dist; // distance mesurée par la tourelle
-float Vitesse=23;
+float Vitesse=45; //23 //40
 float Tourne;
 float Trou;
+int num_capt1[];
+int num_capt2[];
 
 
 CanFrame demande;
@@ -134,12 +136,13 @@
 //CanFrame co3,demande4;
 
 
-void asserv_tour( void);
-void calcul_dist( void);
-void asserv_roue(void );
-void detect_trou (void);
-void vit(void);
+//void asserv_tour( void);
+//void calcul_dist( void);
+//void asserv_roue(void );
+//void detect_trou (void);
+//void vit(void);
 
+
 
 void main()
 {
@@ -158,22 +161,23 @@
 	
 
 	sta_cyc(ID_acqui);
-	sta_tsk(ID_periph_rx);/*
+	sta_tsk(ID_periph_rx);
 	sta_tsk(ID_asserv_tour);
+	sta_tsk(ID_calcul_dist);
 	sta_tsk(ID_asserv_roue);
+	
+	sta_tsk(ID_detect_trou);
 	sta_tsk(ID_vit);
-	sta_tsk(ID_calcul_dist);
-	sta_tsk(ID_detect_trou);
-*/
+
     while(1)
     {
-		
+		/*
 		asserv_tour();
 		asserv_roue();
 		
 		calcul_dist();
 		detect_trou();
-	    vit();
+	    vit();*/
 
 		LED_J=1;
 		dly_tsk(5);
@@ -189,150 +193,192 @@
 
 }
 
-void asserv_tour(void)
-
-{		
-	CanFrame demande;
-	CanFrame co1;
-	float A;
+void asserv_tour()
+{
+	while(1)
+	{		
+		CanFrame demande;
+		CanFrame co1;
+		float A;
 	
-	demande.data.id='R';
-	demande.data.rtr=1;
-	snd_dtq(CanTx,demande.msg);
-	dly_tsk(4);
+		demande.data.id='R';
+		demande.data.rtr=1;
+		snd_dtq(CanTx,demande.msg);
+		dly_tsk(4);
 	
-	A= C - periph[ADDR('R')].val;
+		A= C - periph[ADDR('R')].val;
 	
 	
-	co1.data.id ='T';
-	co1.data.rtr =0;
-	co1.data.val = C - periph[ADDR('R')].val;
-	snd_dtq(CanTx, co1.msg);
-	LED_R=1;
-	dly_tsk(5);			
+		co1.data.id ='T';
+		co1.data.rtr =0;
+		co1.data.val = C - periph[ADDR('R')].val;
+		snd_dtq(CanTx, co1.msg);
+		dly_tsk(5);	
+	}		
 }
 
+
 void calcul_dist()
 {
-//	while(1){
+	while(1)
+	{
 		
-	CanFrame co4;
-	CanFrame demande4;
+		
+		CanFrame co4;
+		CanFrame demande4;
 	
 
-	demande4.data.id='U';
-	demande4.data.rtr=1;
-	snd_dtq(CanTx, demande4.msg);
-	dly_tsk(10);
+		demande4.data.id='U';
+		demande4.data.rtr=1;
+		snd_dtq(CanTx, demande4.msg);
+		dly_tsk(10);
 	
-	Dist= periph[ADDR('U')].val;
-	Tourne= Dist- 580;
-	
-//	}
-		
+		Dist= periph[ADDR('U')].val;
+		Tourne= Dist- 580;
+	}
 
-
 }
-		
+	
 
 void asserv_roue()
 {
 	
-	//while(1){
-		
-	CanFrame co2,co3;
-	CanFrame demande4;
+	while(1)
+	{
+		CanFrame co2,co3;
+		CanFrame demande4;
 	
-	demande4.data.id='U';
-	demande4.data.rtr=1;
-	snd_dtq(CanTx, demande4.msg);
-	dly_tsk(20);
+		demande4.data.id='U';
+		demande4.data.rtr=1;
+		snd_dtq(CanTx, demande4.msg);
+		dly_tsk(20);
 	
-	Dist= periph[ADDR('U')].val;
-	Tourne= Dist- 580;
-	/*
-	if (Dist >1000){
+		Dist= periph[ADDR('U')].val;
+		Tourne= Dist- 580;
+
+	
+		if (Dist >1000){
 			
-		Tourne =0;
+			Tourne =0;
+			co2.data.id ='D';
+			co2.data.rtr =0;
+			co2.data.val = Tourne;
+			snd_dtq(CanTx, co2.msg);
+			dly_tsk(25);
+			
+			co3.data.id ='V';
+			co3.data.rtr =0;
+			co3.data.val = 0;
+			snd_dtq(CanTx, co3.msg);
+		}	
+	
+	
 		co2.data.id ='D';
 		co2.data.rtr =0;
 		co2.data.val = Tourne;
+		
 		snd_dtq(CanTx, co2.msg);
-		//dly_tsk(20);
-			
-		co3.data.id ='V';
-		co3.data.rtr =0;
-		co3.data.val = Vitesse;
-		snd_dtq(CanTx, co3.msg);
+		dly_tsk(25);
 	}
-	*/
-	
-	co2.data.id ='D';
-	co2.data.rtr =0;
-	co2.data.val = Tourne;
+}
 		
-	snd_dtq(CanTx, co2.msg);
-	dly_tsk(25);
-	//}
-		
 	
-		
 	
-}
+	
 
 
+
 void vit()
 {
-//	while(1)
-	//{
-	CanFrame co3;	
+	while(1)
+	{
+		CanFrame co3;
+		CanFrame co8;
+		unsigned char feu;
 	
-	co3.data.id ='V';
-	co3.data.rtr =0;
-	co3.data.val = Vitesse;
-	snd_dtq(CanTx, co3.msg);
-	dly_tsk(10);
-//	}
+		while (Bp_G == 1)
+		{
+			
+			co3.data.id ='V';
+			co3.data.rtr =0;
+			co3.data.val =0;
+			snd_dtq(CanTx, co3.msg);
+		}
+		
+		co8.data.id ='M';
+		co8.data.rtr =1;
+		snd_dtq(CanTx, co8.msg);
 	
+		feu=(periph[ADDR('M')].val)>>8;
+		feu=feu&0x80;
+		if(feu==0x00000000)
+		{
+			co3.data.id ='V';
+			co3.data.rtr =0;
+			co3.data.val = 0;
+			snd_dtq(CanTx, co3.msg);
+			dly_tsk(10);
+		}
+		if(feu==0x10000000)
+		{
+			co3.data.id ='V';
+			co3.data.rtr =0;
+			co3.data.val = Vitesse;
+			snd_dtq(CanTx, co3.msg);
+			dly_tsk(10);
+		}	
+	
+		
+		
+		co3.data.id ='V';
+		co3.data.rtr =0;
+		co3.data.val = Vitesse;
+		snd_dtq(CanTx, co3.msg);
+		dly_tsk(10);
+	}
+	
 }
 
 void detect_trou()
 
 {
-//	while(1)
-//	{
-	CanFrame co6,co2,co3;
-	CanFrame demande4;
+	while(1)
+	{
+		CanFrame co6,co2,co3;
+		CanFrame demande4;
+		int trou;
 	
-	demande4.data.id='U';
-	demande4.data.rtr=1;
-	snd_dtq(CanTx, demande4.msg);
+		demande4.data.id='U';
+		demande4.data.rtr=1;
+		snd_dtq(CanTx, demande4.msg);
 	
-	Dist= periph[ADDR('U')].val;
+		Dist= periph[ADDR('U')].val;
+		trou=0;
+		if (Dist > 1000){
+			LED_R=1;
+			Trou=1;
+		}
+		else LED_R=0;
+		dly_tsk(20);
 		
-	if (Dist > 1000){
-		LED_R=1;
-		Trou=1;
 	}
-	else LED_R=0;
-		
 }	
 
-/*	
-		while(Dist >1000){
-			
-			Tourne =0;
-			co2.data.id ='D';
-			co2.data.rtr =0;
-			co2.data.val = Tourne;
-			snd_dtq(CanTx, co2.msg);
-			
-			co3.data.id ='V';
-			co3.data.rtr =0;
-			co3.data.val = Vitesse;
-			snd_dtq(CanTx, co3.msg);
-			}
-*/	
-		
 	
-	
\ No newline at end of file
+	
+/*
+void detect_capteur(void)
+{
+	CanFrame demande8,demande9;
+	CanFrame co8,co9,co10;
+	
+	co8.data.id ='C';
+	co8.data.rtr =1;
+	snd_dtq(CanTx, co8.msg);
+	
+	num_capt=(periph[ADDR('C')].val)<<3;
+	
+}
+*/
+
+
Index: branch/tchuem/Emb_App/conf_noyau.cfg
===================================================================
--- branch/tchuem/Emb_App/conf_noyau.cfg	(revision 400)
+++ branch/tchuem/Emb_App/conf_noyau.cfg	(revision 401)
@@ -61,6 +61,56 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+
+task[]{
+	entry_address	= asserv_tour();
+	name	= ID_asserv_tour;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 8;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= asserv_roue();
+	name	= ID_asserv_roue;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= vit();
+	name	= ID_vit;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 6;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= calcul_dist();
+	name	= ID_calcul_dist;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 6;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= detect_trou();
+	name	= ID_detect_trou;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 5;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
 	
 
 
