Index: branch/euphrasie_auguste/Emb_App.tws
===================================================================
--- branch/euphrasie_auguste/Emb_App.tws	(revision 326)
+++ branch/euphrasie_auguste/Emb_App.tws	(revision 327)
@@ -13,13 +13,15 @@
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\kernel_id.h" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\kernel_id.h" 25 25 1430 350 0 8 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\mr308.inc" 25 25 1430 351 0 6 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\conf_noyau.cfg" 0 0 1430 351 0 1 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\crt0mr.a30" 0 0 1430 351 0 5 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 0 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\conf_noyau.cfg" -8 -30 1596 536 1 1 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\crt0mr.a30" 0 0 1596 538 0 5 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 0 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\clavier.c" 100 100 1430 351 0 2 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.c" 0 0 1430 351 0 4 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.h" 125 125 1430 351 0 3 
Index: branch/euphrasie_auguste/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/euphrasie_auguste/Emb_App/SessionM32C_E8a_system.hsf	(revision 326)
+++ branch/euphrasie_auguste/Emb_App/SessionM32C_E8a_system.hsf	(revision 327)
@@ -196,7 +196,7 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey1" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_DENORMAL_MODE" "0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_ROUND_MODE" "0" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000004044" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000044" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
@@ -204,12 +204,12 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000512" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF059B" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0595" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000BE8" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000818" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000F0E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000848" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000044" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000" 
@@ -228,7 +228,7 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000008" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000C14" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000F44" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
@@ -260,12 +260,12 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "200" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH" "c,buff,n,rx,flag," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "dist_mur_droit, 3, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "coul_cap_touch, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "commande_D, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "num_cap_touch, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "consigne_T, 1, 0, P, Col, Dec, MA" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "nb_tour, 2, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "commande_V, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "commande_V_max, 1, 0, P, Col, Dec, MA" 
@@ -272,7 +272,7 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "num_piste, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "6" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "3" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -342,15 +342,15 @@
 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 1 "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 1 "0.07" 368 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.08" 365 0 0 350 200 2065 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" 
-"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 2 "0.49" 365 0 0 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
-"{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system0" "WINDOW" 59422 0 3 "0.21" 365 0 0 350 200 18 0 "47300|47301|47302|47303|47304|47305|47314|47306|47307|47308|47311|47312|47313|42211|42509|42303" "0.0" 
-"{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 4 "0.01" 365 0 0 350 200 18 0 "47300|47301|47302|47303|47304|47305|47314|47306|47307|47308|47311|47312|47313|42211|42509|42303" "0.0" 
+"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 2 "0.49" 368 0 0 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
+"{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system0" "WINDOW" 59422 0 4 "0.21" 368 0 0 350 200 18 0 "47300|47301|47302|47303|47304|47305|47314|47306|47307|47308|47311|47312|47313|42211|42509|42303" "0.0" 
+"{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 3 "0.01" 368 0 0 350 200 18 0 "47300|47301|47302|47303|47304|47305|47314|47306|47307|47308|47311|47312|47313|42211|42509|42303" "0.0" 
 "{WK_00000001_REGISTERS}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59421 0 0 "1.00" 236 0 0 350 200 2065 0 "" "0.0" 
-"{WK_00000001_WATCH}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.29" 365 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32772|32773|<<separator>>|32786|<<separator>>|32810|32811" "0.0" 
+"{WK_00000001_WATCH}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.29" 368 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32772|32773|<<separator>>|32786|<<separator>>|32810|32811" "0.0" 
 "{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 308 0 0 350 200 18 0 "" "0.0" 
 "{WK_TB00000001_STANDARD}" "TOOLBAR 0" 59419 0 2 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
 "{WK_TB00000002_EDITOR}" "TOOLBAR 0" 59419 0 0 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
@@ -375,14 +375,15 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\kernel_id.h" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\uart0.c" 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.c" 
+"E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.h" 
 "E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\clavier.c" 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\Emb_App\Debug\mr308.inc" 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.h" 
-"E:\tp_info6_2018_euphrasie_auguste\tp_info6\bsp\periph.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -429,5 +430,5 @@
 [FLASH_DETAILS]
 "" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
 [BREAKPOINTS]
-"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 101051008 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 115301856 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/euphrasie_auguste/Emb_App/programme_principal_etud.c
===================================================================
--- branch/euphrasie_auguste/Emb_App/programme_principal_etud.c	(revision 326)
+++ branch/euphrasie_auguste/Emb_App/programme_principal_etud.c	(revision 327)
@@ -121,7 +121,7 @@
 //'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 periph_command(char addr, short valeur);
+void periph_command(char addr, short valeur);//**
 short periph_requete(char addr);
 
 void initialisation(void);
@@ -131,12 +131,13 @@
 void terrain_rouge(void);
 void terrain_noir(void);
 
-void assser_tourelle(void);
-void asser_roue_vitesse(void);
+void assser_tourelle(VP_INT b);
+void asser_roue_vitesse(VP_INT c);
+void idle(VP_INT d);
 void decode_int(void);
 void capteur(void);
 
-short i;
+//short i;//** **
 short touche;
 short clavier;
 
@@ -159,19 +160,21 @@
 unsigned short num_cap_touch;
 unsigned short num_cap_touch_prec;
 unsigned short nb_tour;
+unsigned short idle_ctr = 0;
+unsigned short idle_max = 65535;
 
-FLGPTN flag;
+FLGPTN flag;//***
 
-void main()
+void main(VP_INT a)
 {
-	initialisation();
+	initialisation();//*
     while(1)
     {
-		num_piste = (periph_requete('M') << 8) >> 8;
-		switch(num_piste)
+		num_piste = (periph_requete('M') << 8) >> 8;//***
+		switch(num_piste)//*
      	   {
      	   	case 1: 
-				 terrain_vert();	break;	
+				 terrain_vert();	break;	//*
 			case 2: 
      	   	     terrain_bleu();	break;
 			case 3: 
@@ -188,29 +191,25 @@
      	   	     terrain_noir();	break;
 		   }
     }
-}
+}
 
-
-
-
 void terrain_vert(void){
-	while((num_piste == 1) || (num_piste == 5)){
-		commande_V_max = 0;
-		for(i=0;i<100;i++){	assser_tourelle();	dly_tsk(10);}
-		periph_command('T', 0);
-		while((periph_requete('M') >> 15) == 0 )	dly_tsk(50); 				// attente feux vert
-		nb_tour = 1;
-		periph_command('D', 0);
+	while((num_piste == 1) || (num_piste == 5)){//*** **
+		commande_V_max = 0;//**
+		consigne_T = 450;
+		nb_tour = 1;//**
+		while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0;	dly_tsk(50);}	//**			// attente feux vert
+		periph_command('D', 0);//**
+		
 		periph_command('V', 60);
-		dly_tsk(250);
+		dly_tsk(250);//***************************************
 		while((num_piste == 1) || (num_piste == 5)){
-			assser_tourelle();
-			asser_roue_vitesse();
-			capteur();
+			capteur();//** **
 			
-			switch(coul_cap_touch)
+			//***** ****** ***** ***** ***** 
+			switch(coul_cap_touch)//*
      	   {
-     	   	case 86: //ligne droite
+     	   	case 86: //ligne droite 'V'
 				 k_D = 1.0;
 				 commande_V_max = 60;
 				 distance_centre = 700;
@@ -229,26 +228,25 @@
 				 distance_centre = 650;
 				 break;
 			}
-			num_piste = (periph_requete('M') << 8) >> 8;
-			dly_tsk(50);
+			num_piste = (periph_requete('M') << 8) >> 8;//***
+			dly_tsk(50);//**
 		}
 	}
+	//***
 }
 
 void terrain_bleu(void){
 	while((num_piste == 2) || (num_piste == 6)){
-		for(i=0;i<100;i++){	assser_tourelle();	dly_tsk(10);}
-		periph_command('T', 0);
-		while((periph_requete('M') >> 15) == 0 )	dly_tsk(50); 				// attente feux vert
+		commande_V_max = 0;
+		consigne_T = 450;
+		nb_tour = 1;
+		while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0;	dly_tsk(50);}				// attente feux vert
 		nb_tour = 1;
 		periph_command('D', 0);
 		periph_command('V', 60);
 		dly_tsk(250);
 		while((num_piste == 2) || (num_piste == 6)){
-			assser_tourelle();
-			asser_roue_vitesse();
 			capteur();
-			
 			switch(coul_cap_touch)
      	   {
      	   	case 86: //ligne droite
@@ -276,15 +274,11 @@
 
 void terrain_rouge(void){
 	while((num_piste == 3) || (num_piste == 7)){
-		for(i=0;i<100;i++){	assser_tourelle();	dly_tsk(10);}
-		periph_command('T', 0);
-		while((periph_requete('M') >> 15) == 0 )	dly_tsk(50); 				// attente feux vert
+		consigne_T = 450;
+		while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0;	dly_tsk(50);}				// attente feux vert
 		nb_tour = 1;
 		while((num_piste == 3) || (num_piste == 7)){
-			assser_tourelle();
-			asser_roue_vitesse();
 			capteur();
-			
 			switch(coul_cap_touch)
      	   {
      	   	case 86: //ligne droite
@@ -293,7 +287,7 @@
 				commande_V_max = 45;
 				if(num_cap_touch == 3){					//saut
 					commande_V_max = 45;
-					k_D = 0.8;
+					k_D = 0.8;//**
 				}
 				else{commande_V_max = 45;}
 				 break;
@@ -320,16 +314,85 @@
 
 void terrain_noir(void){
 	while((num_piste == 4) || (num_piste == 8)){
-		for(i=0;i<100;i++){	assser_tourelle();	dly_tsk(10);}
-		periph_command('T', 0);
-		while((periph_requete('M') >> 15) == 0 )	dly_tsk(50); 				// attente feux vert
+		consigne_T = 450;
+		while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0;	dly_tsk(50);} 				// attente feux vert
 		nb_tour = 1;
 		while((num_piste == 4) || (num_piste == 8)){
-			
-			
-			
-			
-			
+			capteur();
+			switch(coul_cap_touch)
+     	   {
+     	   	case 86:
+				 switch(num_cap_touch)
+     	   		 {
+					 case 1:
+					 consigne_T = 450;
+					 	k_D = 0.6;
+						distance_centre = 550;
+						commande_V_max = 60;
+						break;
+					 case 2:
+					 	consigne_T = 800;
+					 	k_D = 1.3;
+						distance_centre = 500;
+						commande_V_max = 13;
+						break;
+					 case 3:
+					 	consigne_T = 700;
+					 	k_D = 1.1;
+						distance_centre = 500;
+						commande_V_max = 43.75;
+						break;
+					 case 4:
+					 	consigne_T = 450;
+					 	k_D = 1.3;
+						distance_centre = 500;
+						commande_V_max = 12;
+						break;
+				 }
+				 break;
+			case 74 :
+			case 82 :
+			case 66 :
+			case 67 :
+				switch(num_cap_touch)
+     	   		 {
+					 case 1:
+					 	consigne_T = 450;
+						k_D = 1.75;
+				 		distance_centre = 500;
+				 		commande_V_max = 20;
+						break;
+					 case 2:
+					 	consigne_T = 450;
+						k_D = 1.75;
+				 		distance_centre = 500;
+				 		commande_V_max = 20;
+						break;
+					 case 3:
+					 	consigne_T = 600;
+						k_D = 1.75;
+				 		distance_centre = 600;
+				 		commande_V_max = 15;
+						break;
+					 case 4:
+					 	consigne_T = 450;
+						k_D = 1.75;
+				 		distance_centre = 600;
+				 		commande_V_max = 40;
+						break;
+				 }
+				 break;
+					consigne_T = 450;
+					k_D = 1.75;
+				 	distance_centre = 500;
+				 	commande_V_max = 20;
+				 break;
+			 default :
+				 k_D = 1.3;
+				 commande_V_max = 50;
+				 distance_centre = 500;
+				 break;
+		   }
 			num_piste = (periph_requete('M') << 8) >> 8;
 			dly_tsk(50);
 		}
@@ -340,7 +403,7 @@
 	coul_cap_touch = (periph_requete('C') >> 8);
 	num_cap_touch_prec = num_cap_touch;
 	num_cap_touch = (periph_requete('C') & 0x00FF);
-	if((num_cap_touch == 5) && (num_cap_touch != num_cap_touch_prec)){	nb_tour++;	}
+	if((num_cap_touch == 5) && (num_cap_touch != num_cap_touch_prec)){	nb_tour++;	} //*
 }
 
 void decode_int(void){
@@ -347,25 +410,13 @@
 	//short i = 0;
 	//while(touche != '#'){
 		vrcv_dtq(QdmTouche,&touche);
-		clavier = touche-48;
+		clavier = touche-48;//*
 		//i++;
 	//}
 }
 
-void asser_roue_vitesse(void){
-	dist_mur_droit = periph_requete('U')*sin((3.1415f*(periph_requete('R')))/1800.0f);
-	if((dist_mur_droit > 1500) || (dist_mur_droit < -1500)){	dist_mur_droit = distance_centre;} //filtre valeurs aberantes pour trous
-	commande_D = k_D * (dist_mur_droit - distance_centre);
-	if(commande_D < -450)	commande_D = -450;
-	if(commande_D > 450)	commande_D = 450;
-	periph_command('D', commande_D);
-	if(commande_D < 0)	commande_D = commande_D * (-1);
-	//commande_V = commande_V_max - (k_V * (commande_D/10));
-	//if(commande_V < 0)	commande_V = commande_V * (-1);
-	if(Bp_D == 1){commande_V_max = 0;}
-	periph_command('V', commande_V_max);
-}
 
+
 void initialisation(void){
 	ports_mcu();
     lcd_init();
@@ -376,6 +427,8 @@
 	capture_init();
 	sta_cyc(ID_acqui);
 	sta_tsk(ID_periph_rx);
+	sta_tsk(ID_assser_tourelle);
+	sta_tsk(ID_asser_roue_vitesse);
 }
 
 
@@ -384,20 +437,47 @@
 	LED_V=!LED_V;
 }
 
-void assser_tourelle(void){
+
+
+
+
+
+
+void assser_tourelle(VP_INT b){
+	while(1){
 	ang_T = periph_requete('R');
 	commande_T = k_T * (consigne_T - ang_T);
-	periph_command('T', commande_T);
+	periph_command('T', commande_T);//**
+	dly_tsk(25);
+	}
 }
-
-void periph_command(char addr, short valeur){
+void asser_roue_vitesse(VP_INT c){
+	while(1){
+	dist_mur_droit = periph_requete('U')*sin((3.1415f*(periph_requete('R')))/1800.0f);//*** ***
+	if(abs(dist_mur_droit) > 1500){	dist_mur_droit = distance_centre;} //filtre valeurs aberantes pour trous //*** TODO  //***
+	commande_D = k_D * (dist_mur_droit - distance_centre);
+	if(commande_D < -450)	commande_D = -450; //*** clip minmax
+	if(commande_D > 450)	commande_D = 450;
+	periph_command('D', commande_D);
+	if((Bp_D == 1) || (Bp_M == 1)){commande_V_max = 0;}//***
+	periph_command('V', commande_V_max);//***
+	dly_tsk(25);
+	}
+}
+void idle(VP_INT d){
+	while(1){
+		idle_ctr++;
+	}
+}
+void periph_command(char addr, short valeur){//*
 	CanFrame comm;	
 	comm.data.id = addr;
 	comm.data.rtr = 0;
 	comm.data.val = valeur;		
-	snd_dtq (CanTx, comm.msg);
+	snd_dtq (CanTx, comm.msg);//**
 }
 short periph_requete(char addr){
+	//* static ev
 	CanFrame requete, response;
 	short pos;
 	UINT flag;
@@ -407,6 +487,6 @@
 	snd_dtq (CanTx,requete.msg);
 	wai_flg(ev_periph, 0x01, TWF_ANDW, &flag);
 	periph[ADDR(addr)].ev = 0x00;//***
-	pos = periph[ADDR(addr)].val;
+	pos = periph[ADDR(addr)].val;//*
 	return pos;
 }
\ No newline at end of file
Index: branch/euphrasie_auguste/Emb_App/conf_noyau.cfg
===================================================================
--- branch/euphrasie_auguste/Emb_App/conf_noyau.cfg	(revision 326)
+++ branch/euphrasie_auguste/Emb_App/conf_noyau.cfg	(revision 327)
@@ -5,7 +5,6 @@
 //    Generated by M3T-MR308 GUI Configurator at 2013/01/08 15:28:33
 //
 ////////////////////////////////////////////////////////////////////////////////
-
 // system definition
 system{
 	stack_size	= 256;
@@ -17,7 +16,6 @@
 	tic_nume	 = 1;
 	tic_deno	 = 1;
 };
-
 // max definition
 maxdefine{
 	max_task	= 3;
@@ -33,7 +31,6 @@
 	timer	= A0;
 	IPL	= 3;
 };
-
 task[]{
 	entry_address	= main();
 	name	= ID_main;
@@ -44,6 +41,39 @@
 	exinf	= 0x0;
 };
 task[]{
+	entry_address	= assser_tourelle();
+	name	= ID_assser_tourelle;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 8;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+task[]{
+	entry_address	= asser_roue_vitesse();
+	name	= ID_asser_roue_vitesse;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 8;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= idle();
+	name	= ID_idle;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 10;
+	initial_start	= ON;
+	exinf	= 0x0;
+};
+
+
+
+
+
+task[]{
 	entry_address	= periph_tx();
 	name	= ID_periph_tx;
 	stack_size	= 256;
Index: branch/euphrasie_auguste/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/euphrasie_auguste/Emb_App/EmbM32C87App.tps	(revision 326)
+++ branch/euphrasie_auguste/Emb_App/EmbM32C87App.tps	(revision 327)
@@ -18,7 +18,7 @@
 "SessionM32C_E8a_system" 
 [GENERAL_DATA_PROJECT]
 [GENERAL_DATA_CONFIGURATION_Debug]
-"PROJECT_FILES_MODIFIED_DATA_TAG" "TRUE" 
+"PROJECT_FILES_MODIFIED_DATA_TAG" "FALSE" 
 [SESSIONS_Debug]
 "DefaultSession" 
 "SessionM32C_E8a_system" 
