Index: branch/daoud/Emb_App.tws
===================================================================
--- branch/daoud/Emb_App.tws	(revision 301)
+++ branch/daoud/Emb_App.tws	(revision 302)
@@ -7,9 +7,16 @@
 [GENERAL_DATA]
 [BREAKPOINTS]
 [OPEN_WORKSPACE_FILES]
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.c" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.h" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\mli.c" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\mli.h" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\periph.c" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\radiocommande.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c83.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c87.h" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.c" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.h" 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\Debug\mr308.inc" 
@@ -17,11 +24,18 @@
 [WORKSPACE_FILE_STATES]
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\Debug\mr308.inc" 125 125 988 351 0 5 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\conf_noyau.cfg" 150 150 988 351 0 4 
-"E:\tp_info6_2018_daoud\tp_info6\Emb_App\crt0mr.a30" 0 0 1154 539 0 1 
-"E:\tp_info6_2018_daoud\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1154 539 1 0 
+"E:\tp_info6_2018_daoud\tp_info6\Emb_App\crt0mr.a30" -8 -30 1154 539 1 1 
+"E:\tp_info6_2018_daoud\tp_info6\Emb_App\programme_principal_etud.c" 0 0 1154 539 0 0 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.c" 150 150 988 351 0 13 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.h" 75 75 988 351 0 10 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\mli.c" 125 125 1123 351 0 3 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\mli.h" 100 100 988 351 0 11 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\periph.c" 100 100 1430 351 0 2 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\radiocommande.h" 125 125 988 351 0 12 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c83.h" 50 50 988 351 0 9 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c87.h" 25 25 988 351 0 8 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.c" 150 150 988 351 0 6 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.h" 0 0 988 351 0 7 
 [LOADED_PROJECTS]
 "EmbM32C87App" 
 [END]
Index: branch/daoud/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/daoud/Emb_App/SessionM32C_E8a_system.hsf	(revision 301)
+++ branch/daoud/Emb_App/SessionM32C_E8a_system.hsf	(revision 302)
@@ -149,11 +149,11 @@
 "{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" "0000000000FF057D" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0586" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000001016" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000083C" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "000000000000FB4C" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000B30" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000086A" 
+"{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_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "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" "0000000000001038" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B66" 
 "{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" 
@@ -213,7 +213,9 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "vitesse, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Global," 
-"{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_ITEMCnt" "5" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -315,12 +317,19 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_daoud\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_daoud\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.c" 
+"E:\tp_info6_2018_daoud\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\periph.c" 
-"E:\tp_info6_2018_daoud\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daoud\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.c" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\radiocommande.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\mli.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\dma0.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c83.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\sfr32c87.h" 
+"E:\tp_info6_2018_daoud\tp_info6\bsp\uart0.h" 
 "E:\tp_info6_2018_daoud\tp_info6\bsp\mli.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
@@ -368,5 +377,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 98962832 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 99684680 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/daoud/Emb_App/programme_principal_etud.c
===================================================================
--- branch/daoud/Emb_App/programme_principal_etud.c	(revision 301)
+++ branch/daoud/Emb_App/programme_principal_etud.c	(revision 302)
@@ -120,12 +120,12 @@
 //'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 '*'
 short alpha;
-short vitesse,distance;
+short vitesse,distance,capteur;
+CanFrame vite;
 
 
-
 short calcul_vitesse(short distance){
-	
+	while(1){
 	if(distance>=700){
 		//vitesse=(-30/400)*distance+((30*11)/4);
 		vitesse=50*exp(((distance)-700)/800);
@@ -134,14 +134,11 @@
 	if(distance<700){
 		
 		//vitesse=(30/400)*distance -((30*3)/4);
-	 vitesse=50*exp(((-distance)-700)/750);;
+	 vitesse=50*exp(((-distance)-700)/900);;
 		return vitesse;
 		}
-	
-	
-	
-	
 	}
+}
 
 void asserv0_tourelle(){ 
 	short k=1;
@@ -156,13 +153,15 @@
 	//Attente de la réponse
 	wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
 	alpha=periph[ADDR('R')].val;
-		
+	 if(capteur==0x5603){
+		 dly_tsk(50);}
+	else{	
 	//Commande vitesse de la tourelle
 	comm.data.id='T';
 	comm.data.rtr=0; //indique une écriture
 	comm.data.val=k*(450-alpha);
-	snd_dtq(CanTx, comm.msg);
-		
+	snd_dtq(CanTx, comm.msg);}
+	dly_tsk(10);	
 	}
 }	
 void dist(){
@@ -177,11 +176,44 @@
 	//Attente de la réponse
 	wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
 	distance=periph[ADDR('U')].val;
+		dly_tsk(20);
 	}
 
+
+}
+ void det_capteur(){
+ //lecture du capteur 
+	CanFrame req;
+	UINT flag;
+	while(1){
+	req.data.id='C';
+	req.data.rtr=1;
+	periph[ADDR('C')].ev=0x03;
+	snd_dtq(CanTx, req.msg);
+	//Attente de la réponse
+	wai_flg (ev_periph, 0x03, TWF_ANDW, &flag);
+ capteur=periph[ADDR('C')].val;
+ 	dly_tsk(20);
+	}
+ 
+ 
+ }
+ 
+ 
+ 
+
+void det_saut(){
+	while(1){
+if(capteur==0x5603){
+	distance=700;
+	 /* vite.data.val=36;
+    snd_dtq(CanTx, vite.msg);*/
+	
+	}
+	dly_tsk(20);
+	}
 }
 void roue_reg(){
- //lecture de la distance du mur
 
 	CanFrame req;
 	
@@ -191,28 +223,45 @@
 	
 	req.data.id='D';
 	req.data.rtr=0;
+	if(capteur==0x5603){ 
+	req.data.val=0;
+	snd_dtq(CanTx, req.msg);}
+    else{
+		
+       if(distance>1000)distance=701;
+                 
+       else{
+   	       req.data.val=(2)*(distance-700);
+	       snd_dtq(CanTx, req.msg);
   
-	req.data.val=(2)*(distance-700);
-	snd_dtq(CanTx, req.msg);
-
+           }
+       }
+   	dly_tsk(20);
+   }
 }
-}
 void demarrage(){
-		CanFrame comm;
 	
-	dly_tsk(7000);
+	
+	dly_tsk(6000);
 	//test avec vitesse
-    comm.data.id='V';
-    comm.data.rtr=0; 
-
-    comm.data.val=calcul_vitesse(distance);
-    snd_dtq(CanTx, comm.msg);
+	while(1){
+    vite.data.id='V';
+    vite.data.rtr=0; 
+ if(capteur==0x5603){// debut de saut
+	//dly_tsk(10);
+	vite.data.val=50;
+    snd_dtq(CanTx, vite.msg);}
+ else{
+  if(capteur==0x4203){
+	vite.data.val=10;
+    snd_dtq(CanTx, vite.msg);}
 	
-	
-	
-	
-	
-	
+ else{
+   vite.data.val=36;
+    snd_dtq(CanTx, vite.msg);
+     }
+ }
+	dly_tsk(10);}
 	}
 
 void main()
@@ -230,13 +279,14 @@
 
 	sta_cyc(ID_acqui);
 	sta_tsk(ID_periph_rx);
-		
+	
   sta_tsk(ID_asserv0_tourelle);
   sta_tsk(ID_demarrage);
 	sta_tsk(ID_dist);
   	sta_tsk( ID_roue_reg);
+   sta_tsk (ID_det_capteur);
+	sta_tsk (ID_det_saut);
 
-
 
     while(1)
     {
Index: branch/daoud/Emb_App/conf_noyau.cfg
===================================================================
--- branch/daoud/Emb_App/conf_noyau.cfg	(revision 301)
+++ branch/daoud/Emb_App/conf_noyau.cfg	(revision 302)
@@ -89,6 +89,10 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+
+
+
+
 task[]{
 	entry_address	= dist();
 	name	= ID_dist;
@@ -98,6 +102,30 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+
+
+
+task[]{
+	entry_address	= det_saut();
+	name	= ID_det_saut;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 8;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+task[]{
+	entry_address	= det_capteur();
+	name	= ID_det_capteur;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
@@ -105,6 +133,13 @@
 	clear_attribute	= YES;
 	wait_multi	= TA_WMUL;
 };
+
+
+
+
+
+
+
 flag[]{
 	name	= ev_periph;
 	initial_pattern	= 0x0000;
@@ -180,6 +215,7 @@
 
 
 
+
 //
 // End of Configuration
 //
