Index: branch/noisette/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/noisette/Emb_App/SessionM32C_E8a_system.hsf	(revision 202)
+++ branch/noisette/Emb_App/SessionM32C_E8a_system.hsf	(revision 203)
@@ -149,10 +149,10 @@
 "{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" "0000000000FF0580" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF056C" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000009B8" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "00000000000007E6" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000009C8" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "00000000000007F2" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "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" "00000000000009E2" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "00000000000009EE" 
 "{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,7 +207,9 @@
 "{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_SCOPE" "Global," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "1" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance_tourelle, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "2" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -311,11 +313,11 @@
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_noisette\tp_info6\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_noisette\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_noisette\tp_info6\bsp\dma0.c" 
+"E:\tp_info6_2018_noisette\tp_info6\bsp\clavier.c" 
+"E:\tp_info6_2018_noisette\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_noisette\tp_info6\bsp\can.c" 
-"E:\tp_info6_2018_noisette\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_noisette\tp_info6\bsp\lcd.c" 
-"E:\tp_info6_2018_noisette\tp_info6\bsp\dma0.c" 
-"E:\tp_info6_2018_noisette\tp_info6\bsp\clavier.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -362,5 +364,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 101782040 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 87560728 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/noisette/Emb_App/programme_principal_etud.c
===================================================================
--- branch/noisette/Emb_App/programme_principal_etud.c	(revision 202)
+++ branch/noisette/Emb_App/programme_principal_etud.c	(revision 203)
@@ -120,14 +120,16 @@
 //'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 short alpha;
-int consigne;
+int consigne_tourelle;
 unsigned short k;
-int erreur;
-
+int erreur_tourelle;
+int vitesse;
+int distance_tourelle;
+UINT flag;
 void main()
 {
 
-	CanFrame comm, requete, reponse;
+	CanFrame comm, requete, reponse, req;
 	ports_mcu();
     lcd_init();
 	periph_init();
@@ -138,7 +140,7 @@
 	capture_init();
 
 	sta_cyc(ID_acqui);
-//	sta_tsk(ID_periph_rx);
+	sta_tsk(ID_periph_rx);
 
     while(1)
     {
@@ -155,20 +157,50 @@
 		comm.data.id= 'T';
 		comm.data.rtr=0;
 		comm.data.val=0;
-		snd_dtq(CanTx, comm.msg);*/	
+		snd_dtq(CanTx, comm.msg);
 		requete.data.id='R';
 		requete.data.rtr=1;
 		snd_dtq(CanTx, requete.msg);
 		
 		rcv_dtq(CanRx, &reponse.msg);
-		alpha=reponse.data.val;
+		alpha=reponse.data.val;*/
+		req.data.id='R';
+		req.data.rtr=1;
+		periph[ADDR('R')].ev=0x01;
+		snd_dtq(CanTx,req.msg);
+		wai_flg(ev_periph,0x01, TWF_ANDW, &flag);
+		alpha=periph[ADDR('R')].val;
 		
+		dly_tsk(10);
+		
+		req.data.id='U';
+		req.data.rtr=1;
+		periph[ADDR('U')].ev=0x02;
+		snd_dtq(CanTx,req.msg);
+		wai_flg(ev_periph,0x02, TWF_ANDW, &flag);
+		distance_tourelle=periph[ADDR('U')].val;
+		
+		dly_tsk(10);
+		
+		/*requete.data.id='U';
+		requete.data.rtr=1;
+		snd_dtq(CanTx, requete.msg);
+		
+		rcv_dtq(CanRx, &reponse.msg);
+		distance_tourelle=reponse.data.val;*/
+		
 		comm.data.id= 'T';
 		comm.data.rtr=0;
-		comm.data.val=asserv(450);
+		comm.data.val=asserv_tourelle(450);
 		snd_dtq(CanTx, comm.msg);
 		dly_tsk(10);
 		
+/*		comm.data.id= 'V';
+		comm.data.rtr=0;
+		comm.data.val=asserv_vitesse(40);
+		snd_dtq(CanTx, comm.msg);
+		dly_tsk(10);*/
+		
 		
     }
 }
@@ -178,12 +210,23 @@
 	LED_V=!LED_V;
 }
 
-int asserv(consigne)
+int asserv_tourelle(consigne_tourelle)
 {
 		k=1;
-		erreur = consigne - alpha;
-		consigne = k*erreur;
-		return consigne;
+		erreur_tourelle = consigne_tourelle - alpha;
+		consigne_tourelle = k*erreur_tourelle;
+		return consigne_tourelle;
 }
+
+int asserv_vitesse(vitesse) {
+		k = 3;
+		vitesse = distance_tourelle/vitesse;
+		return vitesse;
+}
+
+
+
+
+
 			
 		
\ No newline at end of file
Index: branch/noisette/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/noisette/Emb_App/EmbM32C87App.tps	(revision 202)
+++ branch/noisette/Emb_App/EmbM32C87App.tps	(revision 203)
@@ -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" 
