Index: branch/zemeta/Emb_App.tws
===================================================================
--- branch/zemeta/Emb_App.tws	(revision 315)
+++ branch/zemeta/Emb_App.tws	(revision 316)
@@ -16,8 +16,8 @@
 "E:\tp_info6_2018_zemeta\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
 "E:\tp_info6_2018_zemeta\tp_info6\Emb_App\conf_noyau.cfg" 1 0 1426 347 0 1 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\crt0mr.a30" 125 125 1430 351 0 5 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 4 
+"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\crt0mr.a30" -8 -30 1596 539 1 5 
+"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 4 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\can.c" 50 50 1430 351 0 2 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\dma0.c" 75 75 1430 351 0 3 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\periph.c" 0 0 1430 351 0 7 
Index: branch/zemeta/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/zemeta/Emb_App/SessionM32C_E8a_system.ini	(revision 315)
+++ branch/zemeta/Emb_App/SessionM32C_E8a_system.ini	(revision 316)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff001e
+RESET=ff0020
Index: branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf	(revision 315)
+++ branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf	(revision 316)
@@ -141,20 +141,20 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey0" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" 
 "{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_1" "0000000000000020" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "0000000000000000" 
 "{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" "0000000000FF0576" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B5C" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000896" 
-"{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_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0020" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000700" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000000" 
 "{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" 
@@ -169,12 +169,12 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_31" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_32" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "000000000000036A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "0000000000000000" 
 "{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_4" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B92" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_COUNT" "36" 
@@ -205,21 +205,25 @@
 "{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" "alpha, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "alpha, 10, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "error, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "comm.data.val, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "consigne, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "angle_reel, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "reponse.data.val, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "d_reel, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "d_reel, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "D, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "angle_reel, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "error2, 2, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "7" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007" "gap, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "requete.data.val, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "9" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -321,12 +325,12 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_zemeta\tp_info6\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_2018_zemeta\tp_info6\bsp\can.c" 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\dma0.c" 
-"E:\tp_info6_2018_zemeta\tp_info6\bsp\can.c" 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\uart0.c" 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_zemeta\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_zemeta\tp_info6\Disassembly" 
 [TARGET_NAME]
@@ -375,5 +379,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 100456696 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 102216336 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/zemeta/Emb_App/programme_principal_etud.c
===================================================================
--- branch/zemeta/Emb_App/programme_principal_etud.c	(revision 315)
+++ branch/zemeta/Emb_App/programme_principal_etud.c	(revision 316)
@@ -111,18 +111,16 @@
 //  Bit 15 : Etat feu tricolore ( 1 -> Vert, 0 -> Orange ou Rouge),
 //  Bits 14-8 : 1 Attente, 2 course, 3 essais libres)
 //  Bits 7-0 : numero de la piste
-//'C'/67/0x43 : Informations sur le dernier capteur touche :
-//  8 bits de poids faible : numero du capteur
-//  8 bits de poids fort : couleur ('C','R','J','B' ou 'V')
 //'J'/74/0x4A : Proposition d'un code de dévérouillage.
 //'j'/106/06A : Récupération du résultat de dernier code envoyé. 0x77 si aucun code n'a été soumis. <0 si la réponse n'est pas
 //				disponible. 0xab avec a-> nombre de couleurs bien placées et b -> couleurs présentes mais mal placées.
 //'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 '*'
-CanFrame comm,comm2;
-unsigned short k=1,k2=1, angle_reel, error,error2,d_reel,D=500 ;
-unsigned short consigne_tour = 450 , vitesse = 30 ;  
-CanFrame requete,requete2,reponse, reponse3,requete3 ; 
+CanFrame comm,comm2,comm3;
+unsigned short k=1,k2=1, angle_reel, error,error2,d_reel,D=714, d_max = 2000 ; // D = 500 pour piste verte , D = 714 pour piste verte
+unsigned short consigne_tour = 450 , vitesse = 35 ;  // V = 30 pour piste verte , V = 38 pour piste bleu  
+CanFrame requete,requete3 ; 
+char gap = 0;
 
 
 void main()
@@ -138,6 +136,7 @@
 	sta_tsk(ID_periph_rx);
 
 	//sta_cyc(ID_acqui);
+	//sta_tsk(id_trou);
 	
 	sta_tsk(id_angle);
 	sta_tsk(id_ass_t);	
@@ -145,7 +144,6 @@
 	sta_tsk(id_dist);
 	dly_tsk(2000);
 	sta_tsk(id_avance);
-
 
     while(1)
     {
@@ -191,10 +189,8 @@
 
 void asservissement_tourelle()
 {
-	
 	while(1)
 	{
-
 		//asservissement position tourelle
 		error = consigne_tour - angle_reel ;
 		// envoie nouvelle commande tourelle 
@@ -209,18 +205,19 @@
 
 void ass_roue()
 {
-	//dly_tsk(5000);
 	while(1)
 	{
-		//asservissement position tourelle
-		error2 = D - d_reel ;
-		// envoie nouvelle commande tourelle 
-		comm2.data.id = 'D' ;
-		comm2.data.rtr = 0 ;
-		comm2.data.val = -k2*error2 ; 
-		snd_dtq(CanTx, comm2.msg) ;
-		dly_tsk(10) ; 
+		while (d_reel<d_max)
+		{
+			error2 = D - d_reel ;
+			comm2.data.id = 'D' ;
+			comm2.data.rtr = 0 ;
+			comm2.data.val = -k2*error2 ; 
+			snd_dtq(CanTx, comm2.msg) ;
+		}
+		dly_tsk(10) ;
 	}
+	 
 }
 
 void acquis_distance()
@@ -236,3 +233,22 @@
 		dly_tsk(10);
 	}
 }
+
+
+
+void trou()
+{
+	while(1)
+	{
+		while(d_reel>d_max)
+		{
+			error2 = D - d_reel ;
+			comm2.data.id = 'D' ;
+			comm2.data.rtr = 0 ;
+			comm2.data.val = 0 ; 
+			snd_dtq(CanTx, comm2.msg) ;			
+		}
+		dly_tsk(10) ; 
+	}
+}
+
Index: branch/zemeta/Emb_App/conf_noyau.cfg
===================================================================
--- branch/zemeta/Emb_App/conf_noyau.cfg	(revision 315)
+++ branch/zemeta/Emb_App/conf_noyau.cfg	(revision 316)
@@ -112,6 +112,17 @@
 	exinf	= 0x0;
 };
 
+task[]{
+	entry_address	= trou();
+	name	= id_trou;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 2;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
Index: branch/zemeta/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/zemeta/Emb_App/EmbM32C87App.tps	(revision 315)
+++ branch/zemeta/Emb_App/EmbM32C87App.tps	(revision 316)
@@ -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" 
