Index: branch/zemeta/Emb_App.tws
===================================================================
--- branch/zemeta/Emb_App.tws	(revision 269)
+++ branch/zemeta/Emb_App.tws	(revision 270)
@@ -9,17 +9,19 @@
 [OPEN_WORKSPACE_FILES]
 "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\periph.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\Emb_App\crt0mr.a30" 
 "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 0 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\crt0mr.a30" 125 125 1430 351 0 4 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 3 
-"E:\tp_info6_2018_zemeta\tp_info6\bsp\can.c" 50 50 1430 351 0 1 
-"E:\tp_info6_2018_zemeta\tp_info6\bsp\dma0.c" 75 75 1430 351 0 2 
-"E:\tp_info6_2018_zemeta\tp_info6\bsp\uart0.c" 125 125 1430 351 0 5 
+"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\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 
+"E:\tp_info6_2018_zemeta\tp_info6\bsp\uart0.c" 125 125 1430 351 0 6 
 [LOADED_PROJECTS]
 "EmbM32C87App" 
 [END]
Index: branch/zemeta/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/zemeta/Emb_App/SessionM32C_E8a_system.ini	(revision 269)
+++ branch/zemeta/Emb_App/SessionM32C_E8a_system.ini	(revision 270)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff001a
+RESET=ff001e
Index: branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf	(revision 269)
+++ branch/zemeta/Emb_App/SessionM32C_E8a_system.hsf	(revision 270)
@@ -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" "0000000000FF0572" 
+"{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" "0000000000000B08" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000840" 
+"{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" "0000000000000044" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
 "{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" 
@@ -173,7 +173,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" "0000000000000B3C" 
+"{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_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
@@ -207,13 +207,19 @@
 "{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_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "angle_reel, 2, 0, P, Col, Dec, MN" 
+"{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" "error, 2, 0, P, Col, Dec, MN" 
+"{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" "comm.data.val, 2, 0, P, Col, Dec, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "consigne, 2, 0, P, Col, Dec, MN" 
 "{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" "reponse.data.val, 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_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_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" 
@@ -317,11 +323,12 @@
 [WINDOW_Z_ORDER]
 "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\uart0.c" 
-"E:\tp_info6_2018_zemeta\tp_info6\Emb_App\Debug\Disassembly" 
 "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]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -368,5 +375,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 101890600 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100456696 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 269)
+++ branch/zemeta/Emb_App/programme_principal_etud.c	(revision 270)
@@ -1,4 +1,4 @@
-/***********************************************************************/
+ /***********************************************************************/
 /*                                                                     */
 /*  FILE        :test_compil.c                                         */
 /*  DATE        :Fri, Sep 29, 2006                                     */
@@ -119,10 +119,9 @@
 //				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 alpha ;
-unsigned short k=1, angle_reel, error,error2,vitesse_reel, distance,d_reel ;
-unsigned short consigne= 450 , vitesse = 12 ;  
+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 ; 
 
 
@@ -136,15 +135,17 @@
     can_init();
     clavier_init(1);
 	capture_init();
-	
+	sta_tsk(ID_periph_rx);
+
 	//sta_cyc(ID_acqui);
-	//sta_tsk(id_acqui_pos);
-	//sta_tsk(id_avance);
-	//sta_tsk(id_telemetre);
+	
+	sta_tsk(id_angle);
 	sta_tsk(id_ass_t);	
-	sta_tsk(id_dist);	
+	sta_tsk(id_roue);
+	sta_tsk(id_dist);
+	dly_tsk(2000);
+	sta_tsk(id_avance);
 
-	sta_tsk(ID_periph_rx);
 
     while(1)
     {
@@ -158,31 +159,18 @@
 void acqui()
 {
 	//LED_V=!LED_V;	
-
+	
 }
-void telemetre()
-{
-	while (1)
-	{
-		comm.data.id = 'T' ;
-		comm.data.rtr = 0 ;
-		comm.data.val = 120 ; 
-		snd_dtq(CanTx, comm.msg) ;
-		 
-	}
-}
 
-void acqui_pos()
+void acqui_angle_t()
 {
-	CanFrame requete, reponse ;
 	while (1)
 	{
 		requete.data.id = 'R' ; // variable requete sert a envoyter une requete.
 		requete.data.rtr = 1 ;
 		snd_dtq(CanTx, requete.msg);
-		//rcv_dtq(CanRx, &reponse.msg);
-		dly_tsk(100) ;
-		alpha =	periph[ADDR('R')].val; // reponse.data.val ;  
+		dly_tsk(10) ;
+		angle_reel = periph[ADDR('R')].val;  
 	
 	}
 }
@@ -197,43 +185,42 @@
 		comm.data.rtr = 0 ;
 		comm.data.val = vitesse ; 
 		snd_dtq(CanTx, comm.msg) ;
+		dly_tsk(10);
 	}
-}
+}
 
-
 void asservissement_tourelle()
 {
 	
 	while(1)
 	{
-		
-	/*	//commande vitesse voiture 
-		comm.data.id = 'V' ;
-		comm.data.rtr = 0 ;
-		comm.data.val = vitesse ; 
-		snd_dtq(CanTx, comm.msg) ;*/
-		
-		//recuperation position tourelle
-		requete.data.id = 'R' ; // variable requete sert a envoyter une requete.
-		requete.data.rtr = 1 ;
-		snd_dtq(CanTx, requete.msg);
-		dly_tsk(500) ; 
-		angle_reel = periph[ADDR('R')].val; // lecture donnée avec 
-		
-		
+
 		//asservissement position tourelle
-		error = consigne - angle_reel ;
+		error = consigne_tour - angle_reel ;
 		// envoie nouvelle commande tourelle 
 		comm.data.id = 'T' ;
 		comm.data.rtr = 0 ;
 		comm.data.val = k*error ; 
 		snd_dtq(CanTx, comm.msg) ;
-		dly_tsk(500) ; 
+		dly_tsk(10) ; 
+	}
+}
 
-		
-		
+
+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) ; 
 	}
-	
 }
 
 void acquis_distance()
@@ -241,10 +228,11 @@
 	while(1)
 	{
 		//recuperation distance telemetre
-		requete3.data.id = 'U' ; // variable requete sert a envoyter une requete.
+		requete3.data.id = 'U' ; 
 		requete3.data.rtr = 1 ;
 		snd_dtq(CanTx, requete3.msg);
-		dly_tsk(500) ;
-		d_reel	= periph[ADDR('R')].val;
+		dly_tsk(5);
+		d_reel = periph[ADDR('U')].val;
+		dly_tsk(10);
 	}
 }
Index: branch/zemeta/Emb_App/conf_noyau.cfg
===================================================================
--- branch/zemeta/Emb_App/conf_noyau.cfg	(revision 269)
+++ branch/zemeta/Emb_App/conf_noyau.cfg	(revision 270)
@@ -62,10 +62,9 @@
 	exinf	= 0x0;
 };
 
-
 task[]{
-	entry_address	= acqui_pos();
-	name	= id_acqui_pos;
+	entry_address	= avance_voiture();
+	name	= id_avance;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 2;
@@ -74,8 +73,8 @@
 };
 
 task[]{
-	entry_address	= avance_voiture();
-	name	= id_avance;
+	entry_address	= ass_roue();
+	name	= id_roue;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 2;
@@ -84,8 +83,8 @@
 };
 
 task[]{
-	entry_address	= telemetre();
-	name	= id_telemetre;
+	entry_address	= asservissement_tourelle();
+	name	= id_ass_t;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 2;
@@ -92,10 +91,9 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
-
 task[]{
-	entry_address	= asservissement_tourelle();
-	name	= id_ass_t;
+	entry_address	= acquis_distance();
+	name	= id_dist;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 2;
@@ -102,9 +100,11 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+
+
 task[]{
-	entry_address	= acquis_distance();
-	name	= id_dist;
+	entry_address	= acqui_angle_t();
+	name	= id_angle;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 2;
Index: branch/zemeta/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/zemeta/Emb_App/EmbM32C87App.tps	(revision 269)
+++ branch/zemeta/Emb_App/EmbM32C87App.tps	(revision 270)
@@ -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" 
