Index: branch/tchuem/Emb_App/SessionM32C_FoUSB_UART.hsf
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_FoUSB_UART.hsf	(revision 331)
+++ branch/tchuem/Emb_App/SessionM32C_FoUSB_UART.hsf	(revision 332)
@@ -1,7 +1,7 @@
 [HIMDBVersion]
 2.0
 [DATABASE_VERSION]
-"2.2" 
+"2.3" 
 [SESSION_DETAILS]
 "" 
 [INFORMATION]
@@ -226,6 +226,8 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+[TARGET_NAME]
+"M32C FoUSB/UART" "" 0 
 [STATUSBAR_STATEINFO_VD1]
 "MasterShowState" 1 
 "ApplicationShowState" 1 
@@ -246,8 +248,6 @@
 [STATUSBAR_DEBUGGER_PANESTATE_VD2]
 [STATUSBAR_DEBUGGER_PANESTATE_VD3]
 [STATUSBAR_DEBUGGER_PANESTATE_VD4]
-[TARGET_NAME]
-"M32C FoUSB/UART" 
 [DEBUGGER_OPTIONS]
 "Unknown Options" 
 [DOWNLOAD_MODULES]
@@ -264,6 +264,8 @@
 "FALSE" 
 [DISABLE_MEMORY_ACCESS_DURING_EXECUTION]
 "FALSE" 
+[DEBUGGER_OPTIONS_PROPERTIES]
+"0" 
 [COMMAND_FILES]
 [DEFAULT_DEBUG_FORMAT]
 "IEEE695_RENESAS" 
Index: branch/tchuem/Emb_App/SessionM32C_Simulator.hsf
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_Simulator.hsf	(revision 331)
+++ branch/tchuem/Emb_App/SessionM32C_Simulator.hsf	(revision 332)
@@ -1,7 +1,7 @@
 [HIMDBVersion]
 2.0
 [DATABASE_VERSION]
-"2.2" 
+"2.3" 
 [SESSION_DETAILS]
 "" 
 [INFORMATION]
@@ -34,6 +34,8 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+[TARGET_NAME]
+"" "" 0 
 [STATUSBAR_STATEINFO_VD1]
 "MasterShowState" 1 
 "ApplicationShowState" 1 
@@ -54,8 +56,6 @@
 [STATUSBAR_DEBUGGER_PANESTATE_VD2]
 [STATUSBAR_DEBUGGER_PANESTATE_VD3]
 [STATUSBAR_DEBUGGER_PANESTATE_VD4]
-[TARGET_NAME]
-"" 
 [DEBUGGER_OPTIONS]
 "" 
 [DOWNLOAD_MODULES]
@@ -71,6 +71,8 @@
 "FALSE" 
 [DISABLE_MEMORY_ACCESS_DURING_EXECUTION]
 "FALSE" 
+[DEBUGGER_OPTIONS_PROPERTIES]
+"0" 
 [COMMAND_FILES]
 [DEFAULT_DEBUG_FORMAT]
 "" 
Index: branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 331)
+++ branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 332)
@@ -277,7 +277,7 @@
 0 
 [WINDOW_POSITION_STATE_DATA_VD1]
 "Help" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_00000001_CmdLine}" "WINDOW" 59422 0 0 "0.08" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
+"{WK_00000001_CmdLine}" "WINDOW" 59422 0 0 "0.07" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
 "{WK_00000001_DISASSEMBLY}" "WINDOW" 0 0 0 "0.00" 0 -4 -30 948 486 9 0 "" "0.0" 
 "{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.11" 365 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0" 
 "{WK_00000001_MEMORY}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 1 "0.23" 365 2 -1 350 200 2065 0 "42202|42203|42204|42233|<<separator>>|42206|42205|42230|42229|42207|<<separator>>|42208|42209|42210|49076|42228|42227|<<separator>>|42231|42232|42234|42235|<<separator>>|42211|<<separator>>|32796|32797" "0.0" 
Index: branch/tchuem/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tchuem/Emb_App/programme_principal_etud.c	(revision 331)
+++ branch/tchuem/Emb_App/programme_principal_etud.c	(revision 332)
@@ -120,23 +120,31 @@
 //'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 '*'
 
-float A;
+
 float C=600;
 float Dist; // distance mesurée par la tourelle
-float vit=5;
+float Vitesse=15;
+float Tourne;
+float Trou;
 
 
+/*CanFrame demande;
+CanFrame co1;
+CanFrame co2;*/
+//CanFrame co3,demande4;
+
+
+void asserv_tour( void);
+void calcul_dist( void);
+void asserv_roue(void );
+void detect_trou (void);
+void vit( void);
+
 
 void main()
 {
-	CanFrame co;
-	CanFrame demande1,demande;
-	CanFrame reponse1,reponse;
-	CanFrame co1;
-	CanFrame co2;
-	CanFrame co3;
 
-	
+
 	ports_mcu();
     lcd_init();
 	periph_init();
@@ -147,48 +155,31 @@
     clavier_init(1);
 	capture_init();
 	
-	
+	/*
 
 	sta_cyc(ID_acqui);
 	sta_tsk(ID_periph_rx);
-
-
-
-	
+	sta_tsk(ID_asserv_tour);
+	sta_tsk(ID_asserv_roue);
+	sta_tsk(ID_vit);
+	sta_tsk(ID_calcul_dist);
+	sta_tsk(ID_detect_trou);*/
 
     while(1)
     {
-	
-		demande.data.id='R';
-		demande.data.rtr=1;
-		snd_dtq(CanTx, demande.msg);
-		//rcv_dtq(CanRx, &reponse.msg);
-		A= (C - periph[ADDR('R')].val);
 		
-		co1.data.id ='T';
-		co1.data.rtr =0;
-		co1.data.val = A;
-		snd_dtq(CanTx, co1.msg);
+		asserv_tour();
 		
-		demande1.data.id='U';
-		demande1.data.rtr=1;
-		snd_dtq(CanTx, demande1.msg);
-		Dist= periph[ADDR('U')].val;
-		
-		co1.data.id ='D';
-		co1.data.rtr =0;
-		co1.data.val = 1*(Dist-580);
-		snd_dtq(CanTx, co1.msg);
-		
-		co1.data.id ='V';
-		co1.data.rtr =0;
-		co1.data.val =vit;
-		snd_dtq(CanTx, co1.msg);
+//		calcul_dist();
+ 
+//		detect_trou();
+//vit();
+
 	
 		LED_J=1;
-		dly_tsk(100);
+		dly_tsk(10);
 		LED_J=0;
-		dly_tsk(100);
+		dly_tsk(10);
 	
     }
 }
@@ -198,9 +189,13 @@
 	LED_V=!LED_V;
 
 }
-/*
-void asserv_tour(void)
-{
+
+
+void asserv_tour()
+{		
+	CanFrame demande;
+	CanFrame co1;
+	float A;
 	
 	demande.data.id='R';
 	demande.data.rtr=1;
@@ -207,7 +202,133 @@
 	snd_dtq(CanTx, demande.msg);
 	
 	A= C - periph[ADDR('R')].val;
+	co1.data.id ='T';
+	co1.data.rtr =0;
+	co1.data.val = A;
+	snd_dtq(CanTx, co1.msg);		
+	
 }
 
-*/	
-
+void calcul_dist()
+{
+//	while(1){
+		
+	CanFrame co4;
+	CanFrame demande4;
+	
+
+	demande4.data.id='U';
+	demande4.data.rtr=1;
+	snd_dtq(CanTx, demande4.msg);
+	
+	Dist= periph[ADDR('U')].val;
+	Tourne= Dist- 580;
+	
+//	}
+		
+
+
+}
+		
+
+void asserv_roue()
+{
+	
+	//while(1){
+		
+	CanFrame co2;
+	CanFrame demande4;
+	
+	demande4.data.id='U';
+	demande4.data.rtr=1;
+	snd_dtq(CanTx, demande4.msg);
+	
+	Dist= periph[ADDR('U')].val;
+	Tourne= Dist- 580;
+	/*
+	if (Dist >1000){
+			
+		Tourne =0;
+		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);
+	}
+	*/
+	
+	co2.data.id ='D';
+	co2.data.rtr =0;
+	co2.data.val = Tourne;
+		
+	snd_dtq(CanTx, co2.msg);
+	dly_tsk(10);
+	//}
+		
+	
+		
+	
+}
+
+
+void vit()
+{
+//	while(1)
+	//{
+	CanFrame co3;	
+	
+	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;
+	
+
+	demande4.data.id='U';
+	demande4.data.rtr=1;
+	snd_dtq(CanTx, demande4.msg);
+	
+	Dist= periph[ADDR('U')].val;
+		
+	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
Index: branch/tchuem/Emb_App/conf_noyau.cfg
===================================================================
--- branch/tchuem/Emb_App/conf_noyau.cfg	(revision 331)
+++ branch/tchuem/Emb_App/conf_noyau.cfg	(revision 332)
@@ -61,7 +61,10 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+	
 
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
