Index: branch/font/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/font/Emb_App/SessionM32C_E8a_system.ini	(revision 83)
+++ branch/font/Emb_App/SessionM32C_E8a_system.ini	(revision 84)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff001c
+RESET=ff0020
Index: branch/font/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/font/Emb_App/SessionM32C_E8a_system.hsf	(revision 83)
+++ branch/font/Emb_App/SessionM32C_E8a_system.hsf	(revision 84)
@@ -141,8 +141,8 @@
 "{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" "0000000000000001" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
+"{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_10" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "0000000000000000" 
@@ -149,12 +149,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" "0000000000FF326D" 
+"{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" "0000000000000A3E" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000842" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C0" 
+"{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_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000" 
@@ -172,8 +172,8 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "000000000000036A" 
 "{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" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A3E" 
+"{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_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
@@ -205,9 +205,9 @@
 "{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, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "alpha, 1, 0, P, Col, Dec, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance, 2, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance, 1, 0, P, Col, Dec, MN" 
 "{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_SCOPE" "Current Scope," 
@@ -283,7 +283,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.09" 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.08" 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" 
@@ -316,10 +316,10 @@
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
 "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\bsp\periph.c" 
 "E:\tp_info6_2018_font\bsp\uart0.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\periph.c" 
 "E:\tp_info6_2018_font\bsp\sfr32c83.h" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
@@ -367,5 +367,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 93512136 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 95936032 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 83)
+++ branch/font/Emb_App/programme_principal_etud.c	(revision 84)
@@ -120,13 +120,15 @@
 //'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 '*'
 
-	unsigned int alpha;
-	unsigned int distance;
-	unsigned int distance1;
-	unsigned int angle = 500;
-	unsigned int kroue = 2;
-	unsigned int k = 1;
-	int couleur_capt;
+int alpha;
+int distance;
+int distance1;
+int vitesse = 72;
+int virage = 25;
+int angle = 500;
+int kroue = 1;
+int k = 1;
+int couleur_capt;
 
 void lecture_telemetre(){
 	CanFrame reponsed, requeted;
@@ -134,7 +136,6 @@
 	
 	while(1){
 		//Lecture distance mesurée
-		dly_tsk(2);
 		requeted.data.id = 'U';
 		requeted.data.rtr = 1;	//requete de lecture
 		periph[ADDR('U')].ev = 0x02;
@@ -141,20 +142,30 @@
 		snd_dtq(CanTx, requeted.msg); 
 		wai_flg(ev_periph, 0x02, TWF_ANDW, &flag);	//Attente de lecture
 		distance1 = periph[ADDR('U')].val;
-		if(distance1 > 2000) distance1 = distance;
-		distance = distance1;
+		if(distance1 > 2000){}
+		else {
+			distance = distance1;
+		}
+		dly_tsk(5);
 	}
 }
 
 void asservissement_roue(){
-	CanFrame comm;
+	CanFrame comm, requete;
+	UINT flag;
 	
 	while(1){
-		dly_tsk(5);
 		comm.data.id = 'D';
+		comm.data.rtr = 1;
+		periph[ADDR('D')].ev = 0x03;
+		snd_dtq(CanTx, requete.msg); 
+		wai_flg(ev_periph, 0x03, TWF_ANDW, &flag);	//Attente de lecture
+		
 		comm.data.rtr = 0;
-		comm.data.val = kroue * (distance - 700);
+		angle = kroue * (distance - 700);
+		comm.data.val = angle;
 		snd_dtq(CanTx, comm.msg);
+		dly_tsk(5);		
 	}
 	
 }
@@ -164,7 +175,6 @@
 	CanFrame comm, reponse, requete, m;
 	
 	while(1){
-		dly_tsk(5);
 		//Lecture de la position
 		requete.data.id = 'R';
 		requete.data.rtr = 1;	//requete de lecture
@@ -171,39 +181,40 @@
 		periph[ADDR('R')].ev = 0x01;
 		snd_dtq(CanTx, requete.msg);
 		wai_flg(ev_periph, 0x01, TWF_ANDW, &flag); //Attente de la réponse
-		alpha = periph[ADDR('R')].val;
-		//Contrôle vitesse de rotation de la tourelle
+		alpha = periph[ADDR('R')].val;	//acquisition position tourelle
+		
+		//asservissement en vitesse de rotation de la tourelle
 		comm.data.id = 'T';
 		comm.data.rtr = 0;
-		//asservissement en vitesse
 		comm.data.val = k * (450 - alpha);
 		snd_dtq(CanTx, comm.msg);
+		dly_tsk(5);		
 	}
-	
 }
 
-void vitesse(){
+void demarrage(){
 	CanFrame comm, requete;
-	UINT flag;
+
+	dly_tsk(4000);
+	comm.data.id = 'V';
+	comm.data.rtr = 0;
+	comm.data.val = vitesse;
+	snd_dtq(CanTx, comm.msg);
 	
-		//démarrage de la voiture
-		dly_tsk(500);
-		
-		
-		while(1){
-			comm.data.id = 'C';
-			comm.data.rtr = 0;
-			periph[ADDR('C')].ev = 0x03;
+	while(1){
+		comm.data.id = 'V';
+		comm.data.rtr = 0;
+		if(angle > 40 || angle < -40){
+			comm.data.val = virage;
 			snd_dtq(CanTx, comm.msg);
-			wai_flg(ev_periph,0x01,TWF_ANDW, &flag);
-			couleur_capt = periph[ADDR('C')].val>>2;
-			comm.data.id = 'V';
-			comm.data.rtr = 0;
-			if(couleur_capt == 5504) comm.data.val = 30;
-			else comm.data.val = 20;
+		}	
+		else {
+			comm.data.val = vitesse;
 			snd_dtq(CanTx, comm.msg);
 		}
+	}	
 }
+
 
 void main()
 {
@@ -216,9 +227,9 @@
     clavier_init(1);
 	capture_init();
 
+	sta_tsk(ID_periph_rx);
+	sta_tsk(ID_demarrage);
 	sta_cyc(ID_acqui);
-	sta_tsk(ID_periph_rx);
-	sta_tsk(ID_vitesse);
 	sta_tsk(ID_tsk_asserv1);
 	sta_tsk(ID_lecture_telemetre);
 	sta_tsk(ID_asservissement_roue);
Index: branch/font/Emb_App/conf_noyau.cfg
===================================================================
--- branch/font/Emb_App/conf_noyau.cfg	(revision 83)
+++ branch/font/Emb_App/conf_noyau.cfg	(revision 84)
@@ -93,8 +93,8 @@
 };
 
 task[]{
-	entry_address	= vitesse();
-	name	= ID_vitesse;
+	entry_address	= demarrage();
+	name	= ID_demarrage;
 	stack_size	= 512;
 	stack_section	= stack;
 	priority	= 4;
Index: branch/font/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/font/Emb_App/EmbM32C87App.tps	(revision 83)
+++ branch/font/Emb_App/EmbM32C87App.tps	(revision 84)
@@ -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" 
