Index: branch/font/Emb_App.tws
===================================================================
--- branch/font/Emb_App.tws	(revision 228)
+++ branch/font/Emb_App.tws	(revision 229)
@@ -12,11 +12,13 @@
 "E:\tp_info6_2018_font\bsp\uart0.c" 
 "E:\tp_info6_2018_font\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_font\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_font\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_font\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"E:\tp_info6_2018_font\Emb_App\Debug\mr308.inc" 150 150 1430 351 0 6 
 "E:\tp_info6_2018_font\Emb_App\conf_noyau.cfg" 75 75 1430 351 0 2 
-"E:\tp_info6_2018_font\Emb_App\crt0mr.a30" 0 0 1596 539 0 0 
-"E:\tp_info6_2018_font\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 1 
+"E:\tp_info6_2018_font\Emb_App\crt0mr.a30" -8 -30 1596 539 1 0 
+"E:\tp_info6_2018_font\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 1 
 "E:\tp_info6_2018_font\bsp\periph.c" 100 100 1430 351 0 4 
 "E:\tp_info6_2018_font\bsp\sfr32c83.h" 100 100 1430 351 0 3 
 "E:\tp_info6_2018_font\bsp\uart0.c" 150 150 1430 351 0 5 
Index: branch/font/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/font/Emb_App/SessionM32C_E8a_system.ini	(revision 228)
+++ branch/font/Emb_App/SessionM32C_E8a_system.ini	(revision 229)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0026
+RESET=ff002a
Index: branch/font/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/font/Emb_App/SessionM32C_E8a_system.hsf	(revision 228)
+++ branch/font/Emb_App/SessionM32C_E8a_system.hsf	(revision 229)
@@ -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" "0000000000000104" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000044" 
+"{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" "0000000000FF1DA9" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B0C" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000846" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000004" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004041" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF002A" 
+"{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" "0000000000000006" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000007" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B42" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
+"{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" "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" 
@@ -199,21 +199,27 @@
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ECX_IMAGE_VIEW" "0,0,0,0,0,0" 
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ImageCtrlViews" "0" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchCtrlViews" "4" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth0" "148" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth0" "180" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth1" "186" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "200" 
 "{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, 1, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "feuv, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance, 1, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "feu, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "couleur_capt, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "num_piste1, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "val_capt, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "num_piste, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "4" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "capteur, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "montee, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "a, 1, 0, P, Col, Hex, MA" 
+"{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}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -283,7 +289,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 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" 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" 
@@ -315,11 +321,12 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_font\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_font\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_font\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_font\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_2018_font\bsp\uart0.c" 
+"E:\tp_info6_2018_font\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_font\bsp\periph.c" 
-"E:\tp_info6_2018_font\bsp\uart0.c" 
-"E:\tp_info6_2018_font\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_font\bsp\sfr32c83.h" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
@@ -367,5 +374,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 95936032 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100391144 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/font/Emb_App/programme_principal_etud.c
===================================================================
--- branch/font/Emb_App/programme_principal_etud.c	(revision 228)
+++ branch/font/Emb_App/programme_principal_etud.c	(revision 229)
@@ -130,8 +130,9 @@
 int alpha;							//angle tourelle
 int distance;						//distance du bord mesurée
 int distance1;
-int vitesse = 45;					//vitesse souhaitée
+int vitesse = 60;					//vitesse souhaitée
 int vitesse_virage = 25;			//vitesse pendant un virage souhaitée
+int vitesse_montee = 25;
 int angle_roue;				
 int kroue = 1;
 int k = 1;
@@ -138,10 +139,11 @@
 int num_piste;
 int num_piste1;
 int capteur;
-int f_capt;
-int s_capt;
 int a = 0;
 char saut = 0;
+int feu;
+int feuv;
+int montee = 0;
 
 void lecture_telemetre(){
 	CanFrame reponsed, requeted;
@@ -176,7 +178,9 @@
 		wai_flg(ev_periph, 0x03, TWF_ANDW, &flag);	//Attente de lecture de l'angle des roues
 		
 		comm.data.rtr = 0;
-		if(saut == 0) angle_roue = kroue * (distance - distance_bord);	//Asservissement de l'angle
+		if(saut == 0){ 						//Aucun saut franchi
+			 angle_roue = kroue * (distance - distance_bord);	//Asservissement de l'angle
+		}
 		else angle_roue = 0;
 		comm.data.val = angle_roue;
 		snd_dtq(CanTx, comm.msg);
@@ -207,6 +211,7 @@
 	}
 }
 
+//lis la piste sur laquelle on roule
 void lecture_piste(){
 	CanFrame requete;
 	UINT flag;
@@ -217,9 +222,10 @@
 	snd_dtq(CanTx, requete.msg);
 	wai_flg(ev_periph, 0x04, TWF_ANDW, &flag); //Attente de la réponse
 	num_piste = periph[ADDR('M')].val;	//acquisition numéro piste
-	num_piste1 = num_piste && 0x0fff;
+	num_piste1 = num_piste & 0x00ff;
 }
 
+//lis le dernier capteur franchi
 void lecture_capteur(){
 	CanFrame requete;
 	UINT flag;
@@ -236,12 +242,28 @@
 	}
 }
 
+//gère la montée piste bleu
+void gestion_montee (){
+	
+	while(1){
+		if(num_piste1 == 2){ //détection piste rouge
+			if( capteur == 0x5604 ){	//détection capteur avant saut
+				montee = 1;
+			}	
+			else {
+				montee = 0;
+			}
+		}
+		dly_tsk(5);
+	}
+}
+
+//gère le saut piste rouge
 void gestion_saut (){
-	CanFrame comm;
 	
 	while(1){
-		if(num_piste1 == 1){ //détection piste rouge
-			if( capteur == 0x5603 ){
+		if(num_piste1 == 7){ //détection piste rouge
+			if( capteur == 0x5603 ){	//détection capteur avant saut
 				saut = 1;
 			}	
 			else {
@@ -248,11 +270,29 @@
 				saut = 0;
 			}
 		}
-		dly_tsk(2);
+		dly_tsk(5);
 	}
 }
 
+//detecte si le feu est vert
+void detect_feuv(){
+	CanFrame requete;
+	UINT flag;
+	
+	while(1){
+		//Lecture de la zone
+		requete.data.id = 'M';
+		requete.data.rtr = 1;	
+		periph[ADDR('M')].ev = 0x06;
+		snd_dtq(CanTx, requete.msg);
+		wai_flg(ev_periph, 0x06, TWF_ANDW, &flag); //Attente de la réponse
+		feu = periph[ADDR('M')].val;	//acquisition du dernier capteur franchi
+		feuv = feu & 0x8000;
+		dly_tsk(3);
+	}
+}
 
+
 //Fonction de demarrage de la voiture
 void demarrage(){
 	CanFrame comm, requete;
@@ -259,25 +299,32 @@
 	UINT flag;
 
 	dly_tsk(4000);			//Attente avant départ
-		
-	comm.data.id = 'V';
-	comm.data.rtr = 0;
-	comm.data.val = vitesse;	//Démarrage
-	snd_dtq(CanTx, comm.msg);
 	
-		while(1){
+	//if(feuv == 0x8000){		//Départ feu vert
 		comm.data.id = 'V';
 		comm.data.rtr = 0;
-		if(angle_roue > 40 || angle_roue < -40){	//ralentissement de la voiture si angle demandé trop grand
-			comm.data.val = vitesse_virage;
-			snd_dtq(CanTx, comm.msg);
-		}	
-		else {
-			comm.data.val = vitesse;
-			snd_dtq(CanTx, comm.msg);
+		comm.data.val = vitesse;	//Démarrage
+		snd_dtq(CanTx, comm.msg);
+	
+			while(1){
+			comm.data.id = 'V';
+			comm.data.rtr = 0;
+			if(angle_roue > 40 || angle_roue < -40){	//ralentissement de la voiture si angle demandé trop grand
+				comm.data.val = vitesse_virage;
+				snd_dtq(CanTx, comm.msg);
+			}	
+			else{
+				comm.data.val = vitesse;
+				snd_dtq(CanTx, comm.msg);
+			}
+			if(montee == 1){
+				comm.data.val = vitesse_montee;
+				snd_dtq(CanTx, comm.msg);
+				a = 1;
+			}
+			dly_tsk(3);	
 		}
-		dly_tsk(3);	
-	}
+	//}	acolade if départ feu vert
 }
 
 
@@ -296,9 +343,11 @@
 	sta_tsk(ID_lecture_piste);
 	sta_tsk(ID_lecture_capteur);
 	sta_tsk(ID_demarrage);
-	sta_cyc(ID_acqui);
+	sta_cyc(ID_acqui);
+	sta_tsk(ID_gestion_montee);
 	sta_tsk(ID_tsk_asserv1);
 	sta_tsk(ID_lecture_telemetre);
+	sta_tsk(ID_detect_feuv);
 	sta_tsk(ID_asservissement_roue);
 	sta_tsk(ID_gestion_saut);
     
Index: branch/font/Emb_App/conf_noyau.cfg
===================================================================
--- branch/font/Emb_App/conf_noyau.cfg	(revision 228)
+++ branch/font/Emb_App/conf_noyau.cfg	(revision 229)
@@ -77,17 +77,37 @@
 	name	= ID_lecture_telemetre;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 3;
+	priority	= 4;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
 task[]{
+	entry_address	= detect_feuv();
+	name	= ID_detect_feuv;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 4;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= gestion_montee();
+	name	= ID_gestion_montee;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 4;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
 	entry_address	= asservissement_roue();
 	name	= ID_asservissement_roue;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 3;
+	priority	= 4;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
Index: branch/font/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/font/Emb_App/EmbM32C87App.tps	(revision 228)
+++ branch/font/Emb_App/EmbM32C87App.tps	(revision 229)
@@ -18,7 +18,7 @@
 "SessionM32C_E8a_system" 
 [GENERAL_DATA_PROJECT]
 [GENERAL_DATA_CONFIGURATION_Debug]
-"PROJECT_FILES_MODIFIED_DATA_TAG" "FALSE" 
+"PROJECT_FILES_MODIFIED_DATA_TAG" "TRUE" 
 [SESSIONS_Debug]
 "DefaultSession" 
 "SessionM32C_E8a_system" 
