Index: branch/daval/Emb_App.tws
===================================================================
--- branch/daval/Emb_App.tws	(revision 314)
+++ branch/daval/Emb_App.tws	(revision 315)
@@ -20,8 +20,8 @@
 "E:\tp_info6_2018_daval\Emb_App\Debug\mr308.inc" 25 25 1430 351 0 8 
 "E:\tp_info6_2018_daval\Emb_App\Debug\mrtable.a30" 150 150 1430 351 0 6 
 "E:\tp_info6_2018_daval\Emb_App\conf_noyau.cfg" 0 0 1430 351 0 7 
-"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 25 25 1430 351 0 1 
-"E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 0 
+"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" -8 -30 1596 539 1 1 
+"E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 0 
 "E:\tp_info6_2018_daval\bsp\mli.c" 125 125 1430 351 0 5 
 "E:\tp_info6_2018_daval\bsp\periph.c" 50 50 1430 351 0 2 
 "E:\tp_info6_2018_daval\bsp\radiocommande.c" 75 75 1430 351 0 3 
Index: branch/daval/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/daval/Emb_App/SessionM32C_E8a_system.ini	(revision 314)
+++ branch/daval/Emb_App/SessionM32C_E8a_system.ini	(revision 315)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0028
+RESET=ff002a
Index: branch/daval/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/daval/Emb_App/SessionM32C_E8a_system.hsf	(revision 314)
+++ branch/daval/Emb_App/SessionM32C_E8a_system.hsf	(revision 315)
@@ -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" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000056" 
 "{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" 
@@ -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" "0000000000FF3285" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0495" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000A4E" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000852" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000005" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C0" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B22" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000842" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "00000000000000C0" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000080" 
 "{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" 
@@ -219,7 +219,7 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_27" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_28" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_29" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000000001" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_30" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_31" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_32" "0000000000000000" 
@@ -226,9 +226,9 @@
 "{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_35" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000005" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000512" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A4E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000B3A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B3E" 
 "{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" 
@@ -254,18 +254,18 @@
 "{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" "217" 
 "{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" "valeur, 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" "angle, 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" "distance_mesure, 1, 0, P, Col, Dec, MN" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "distance_mesure, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "angle_mesure, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "angle_corrige, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "3" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
@@ -336,15 +336,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 2 "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 2 "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" 
-"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 3 "0.52" 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_OUTPUT}" "WINDOW" 59422 0 3 "0.44" 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 1 "0.07" 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_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 5 "0.30" 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 5 "0.38" 365 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" 
@@ -369,11 +369,11 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daval\bsp\uart0.c" 
+"E:\tp_info6_2018_daval\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daval\Emb_App\Debug\mr308.inc" 
-"E:\tp_info6_2018_daval\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daval\Emb_App\Debug\mrtable.a30" 
 "E:\tp_info6_2018_daval\bsp\periph.c" 
 "E:\tp_info6_2018_daval\bsp\mli.c" 
@@ -424,5 +424,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 92744024 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 80423256 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/daval/Emb_App/programme_principal_etud.c
===================================================================
--- branch/daval/Emb_App/programme_principal_etud.c	(revision 314)
+++ branch/daval/Emb_App/programme_principal_etud.c	(revision 315)
@@ -127,16 +127,17 @@
 char k=1; 				//gain du correcteur
 int angle_corrige = 0 ; 		//valeur envoyee
 
+
 //Asservissement de la voiture
-int consigne_roue=700;		// Consigne qui permet d etre bien centré sur la route
+int distance_mur=700;		// Consigne qui permet d etre bien centré sur la route
 char C=1;					// Gain asservissment des roues
-int vitesse_voulue= 35;		// Commande de vitesse que l'on envoie
-
+int vitesse_rapide= 60;//Commande de vitesse que l'on envoie
+int vitesse_lente=30;
 int distance_mesure=0;
+int cap;
 
 
-
-void asservissement()
+void asservissement_tourelle()
 {
 	CanFrame commande;
 	CanFrame requete;
@@ -163,24 +164,36 @@
 		dly_tsk(15);
 	}
 }
+CanFrame vitesse;				//Sotie de la tache avance car utilisée dans la tache de l'asservissment de cap
+CanFrame orientation_roue;
+CanFrame requete;
 
 void avance()
 {
-	CanFrame vitesse;
-	CanFrame orientation_roue;
-	CanFrame requete;
 	
-/*	orientation_roue.data.id='D';
-	orientation_roue.data.rtr=1;						//Debut de l'acquisition de l'angle pour  faire relentir la voiture dans les virages
-	int orientation = periph[ADDR('U')].val;*/
+	dly_tsk(2000);
 	
+	
 	vitesse.data.id='V';				//Envoi d'une commande en vitesse
-	vitesse.data.rtr=0; 				//Indique une ecriture
+	vitesse.data.rtr=0; 				//Indique une ecritur
+	while(1)
+	{
+		if(cap<-50 || cap>50) 
+		{
+			vitesse.data.val=vitesse_lente;
+			snd_dtq (CanTx,vitesse.msg);
+		}
+		else 
+		{
+			vitesse.data.val=vitesse_rapide;
+			snd_dtq (CanTx,vitesse.msg);
+		}
+		dly_tsk(10);
+	}
+
 	
-	vitesse.data.val=vitesse_voulue;	
-	snd_dtq (CanTx,vitesse.msg);
-	dly_tsk(15);
 	
+	
 
 }
 void distance_bord()
@@ -207,13 +220,13 @@
 		distance_mesure=periph[ADDR('U')].val;
 		}
 		
-		dly_tsk(5);
+		dly_tsk(10);
 		
 	}
 }
 
 
-void angle_roues()
+void asserv_cap()
 {
         CanFrame requete,commande;
         UINT flag;
@@ -226,10 +239,11 @@
         snd_dtq(CanTx, requete.msg);
         wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
         commande.data.id='D';
-        commande.data.rtr=0; 
-        commande.data.val= C*(distance_mesure-consigne_roue);
+        commande.data.rtr=0;
+        cap=C*(distance_mesure-distance_mur);
+		commande.data.val= cap;
         snd_dtq(CanTx, commande.msg);
-		dly_tsk(5);
+		dly_tsk(10);
 	}
 }
 
@@ -251,9 +265,9 @@
 
 	sta_cyc(ID_acqui);
 	sta_tsk(ID_periph_rx); //Si on utilise cette tâche on ne doit plus utiliser canRX
-	sta_tsk(ID_asservissement);
+	sta_tsk(ID_asservissement_tourelle);
 	sta_tsk(ID_distance_bord);
-	sta_tsk(ID_angle_roues);
+	sta_tsk(ID_asserv_cap);
 	sta_tsk(ID_avance);
 	while(1);
 	
Index: branch/daval/Emb_App/conf_noyau.cfg
===================================================================
--- branch/daval/Emb_App/conf_noyau.cfg	(revision 314)
+++ branch/daval/Emb_App/conf_noyau.cfg	(revision 315)
@@ -62,8 +62,8 @@
 	exinf	= 0x0;
 };
 task[]{
-	entry_address	= asservissement();
-	name	= ID_asservissement;
+	entry_address	= asservissement_tourelle();
+	name	= ID_asservissement_tourelle;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 3;
@@ -75,7 +75,7 @@
 	name	= ID_avance;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 5;
+	priority	= 4;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
@@ -85,17 +85,17 @@
 	name	= ID_distance_bord;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 4;
+	priority	= 6;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
 task[]{
-	entry_address	= angle_roues();
-	name	= ID_angle_roues;
+	entry_address	= asserv_cap();
+	name	= ID_asserv_cap;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 4;
+	priority	= 5;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
