Index: branch/diagne/Emb_App/SessionM32C_FoUSB_UART.hsf
===================================================================
--- branch/diagne/Emb_App/SessionM32C_FoUSB_UART.hsf	(revision 233)
+++ branch/diagne/Emb_App/SessionM32C_FoUSB_UART.hsf	(revision 234)
@@ -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/diagne/Emb_App/SessionM32C_Simulator.hsf
===================================================================
--- branch/diagne/Emb_App/SessionM32C_Simulator.hsf	(revision 233)
+++ branch/diagne/Emb_App/SessionM32C_Simulator.hsf	(revision 234)
@@ -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/diagne/Emb_App/programme_principal_etud.c
===================================================================
--- branch/diagne/Emb_App/programme_principal_etud.c	(revision 233)
+++ branch/diagne/Emb_App/programme_principal_etud.c	(revision 234)
@@ -123,76 +123,72 @@
 
 short alpha;
 short vitesse, longueur;
-short pos;
+
 void Asserv0(){	
 	
-		CanFrame req, comm;
-		UINT flag;
-		while (1)
-		{
-			req.data.id='R';
-			req.data.rtr=1; 
-			//requête de lecture
+		CanFrame req,reponse,comm;
+		UINT flag;	
+		while(1)
+		{	
+			req.data.id='R'; //lecture angle de la tourelle
+			req.data.rtr=1; //requête de lecture
+			snd_dtq(CanRx, req.msg);
+			//Attente de la réponse
+			//rcv_dtq(CanRx, &reponse.msg);
 			periph[ADDR('R')].ev=0x01;
-			snd_dtq(CanTx, req.msg);
-			//Attente de la réponse
-			wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
-			pos=periph[ADDR('R')].val;
-			//Lecture de la valeur
-	
-	 		//CanFrame demande;
-	   		 //CanFrame reponse;
-	 		//CanFrame comm;
+			snd_dtq(CanTx,req.msg);
+			wai_flg(ev_periph, 0x01, TWF_ANDW,&flag);
+			alpha=periph[ADDR('R')].val;
+			
+			//Vitesse de la tourelle
 			comm.data.id='T'; 
 			comm.data.rtr=0;
-	 		comm.data.val=450-pos; // Pour un gain de 1, on regule pour avoir 45degrés
-			snd_dtq (CanTx,comm.msg);
-		}
-	
+	 		comm.data.val=450-alpha; // Pour un gain de 1, on regule pour avoir 45degrés
+			snd_dtq(CanTx,comm.msg);
+			dly_tsk(100);
+		}	
+		
 }
 
-void distance(){
-	CanFrame req;
-	UINT flag;
-	req.data.id='U';
-	req.data.rtr=1;
-	periph[ADDR('U')].ev=0x01;
-	snd_dtq(CanTx, req.msg);
-	//Attente de la réponse
-	wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
-	longueur=periph[ADDR('U')].val;
-	
 
-}
-
-
 void regulation_roue(){
- CanFrame req;
-	while(1){
-		UINT flag;
-		req.data.id='D';
-		req.data.rtr=0;
-		req.data.val=2*(longueur-737);
-		snd_dtq(CanTx, req.msg);
-		
-	}
+		CanFrame req,reponse,comm;
+		UINT flag;	
+		while(1)
+		{	
+			req.data.id='U'; //lecture angle de la tourelle
+			req.data.rtr=1; //requête de lecture
+			snd_dtq(CanRx, req.msg);
+			//Attente de la réponse
+			//rcv_dtq(CanRx, &reponse.msg);
+			periph[ADDR('U')].ev=0x01;
+			snd_dtq(CanTx,req.msg);
+			wai_flg(ev_periph, 0x01, TWF_ANDW,&flag);
+			alpha=periph[ADDR('U')].val;
+			
+			//Vitesse de la tourelle
+			comm.data.id='D'; 
+			comm.data.rtr=0;
+	 		comm.data.val=-(450-alpha); // Pour un gain de 1, on regule pour avoir 45degrés
+			snd_dtq(CanTx,comm.msg);
+			dly_tsk(100);
+		}
 }
-
+	
 void Avancer(){
-	CanFrame requete;
+	CanFrame req;
+	dly_tsk(6000);
+	req.data.id='V';
+	req.data.rtr=0;
+	req.data.val=15;
+	snd_dtq(CanTx,req.msg);
 	
-	dly_tsk(5000);
-	//test avec vitesse
-  requete.data.id='V';
-    requete.data.rtr=0; 
-    requete.data.val=48;
-    snd_dtq(CanTx, requete.msg);
+}
 
-}
 	
 void main()
 {
-	CanFrame requete,reponse,comm;
+	CanFrame req,reponse,comm;
 	ports_mcu();
     lcd_init();
 	periph_init();
@@ -203,16 +199,17 @@
     clavier_init(1);
 	capture_init(); 
 	
+	
+	
 	//Variables globales utlisées par les asservissements
 	
 	
 	sta_cyc(ID_acqui);
-	sta_tsk(ID_periph_rx);
+  	sta_tsk(ID_periph_rx);
 	sta_tsk(ID_Asserv0);
-	distance;
-	regulation_roue;
-	distance();
-	Avancer();
+ 	sta_tsk(ID_Avancer);
+	sta_tsk(ID_roue);
+
 	
     while(1)
     {
@@ -221,10 +218,8 @@
 		dly_tsk(100);
 		LED_J=0;
 		dly_tsk(100);
-		
+	    }
 	
-    }
-	
 }
 
 void acqui()
Index: branch/diagne/Emb_App/conf_noyau.cfg
===================================================================
--- branch/diagne/Emb_App/conf_noyau.cfg	(revision 233)
+++ branch/diagne/Emb_App/conf_noyau.cfg	(revision 234)
@@ -67,11 +67,31 @@
 	name	= ID_Asserv0;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 9;
+	priority	= 5;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+task[]{
+	entry_address	= Avancer();
+	name	= ID_Avancer;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
 
+task[]{
+	entry_address	= regulation_roue();
+	name	= ID_roue;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
