Index: branch/belin/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/belin/Emb_App/SessionM32C_E8a_system.ini	(revision 347)
+++ branch/belin/Emb_App/SessionM32C_E8a_system.ini	(revision 348)
@@ -10,8 +10,8 @@
 VOLTAGE_5_0=1
 VOLTAGE_3_3=0
 [FW_LOCATE]
-FWADDRESS=f000
-RAMADDRESS=04
+FWADDRESS=ffd0
+RAMADDRESS=c3
 [WDT]
 WDT_USE=0
 [MCU_SETTING]
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff001a
+RESET=ff0022
Index: branch/belin/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/belin/Emb_App/SessionM32C_E8a_system.hsf	(revision 347)
+++ branch/belin/Emb_App/SessionM32C_E8a_system.hsf	(revision 348)
@@ -142,19 +142,19 @@
 "{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" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
+"{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" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "0000000000000000" 
 "{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" "0000000000FF17D2" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000CF6" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000808" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004005" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FFFFFF" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000700" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000000" 
 "{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" 
@@ -164,17 +164,17 @@
 "{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" "0000000000003000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000000000" 
 "{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" 
 "{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_34" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000D22" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_COUNT" "36" 
@@ -205,7 +205,7 @@
 "{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" "capt, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "capt, 2, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "correction, 10, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
@@ -849,8 +849,8 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 
 "E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 
-"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 
 "E:\tp_info_2018_belin\Emb_App\Debug\mr308.inc" 
 "E:\tp_info_2018_belin\Emb_App\conf_noyau.cfg" 
 "E:\tp_info_2018_belin\bsp\periph.c" 
@@ -908,5 +908,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 101067480 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 99166936 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/belin/Emb_App/programme_principal_etud.c
===================================================================
--- branch/belin/Emb_App/programme_principal_etud.c	(revision 347)
+++ branch/belin/Emb_App/programme_principal_etud.c	(revision 348)
@@ -123,6 +123,9 @@
 unsigned short pos_tourelle;
 unsigned short capt=0;
 unsigned short GEL=0;
+unsigned short NomPiste;
+unsigned short consigneP;
+unsigned short Distance;
 
 	
 
@@ -130,30 +133,26 @@
 
 
 	CanFrame req;
-	UINT flag;
 	CanFrame comm;
-	unsigned short correction, retour, consigne;
+	unsigned short correction, retour, consigneT;
 	
-	consigne=450; 
+	consigneT=450; 
 	
 	while(1){
-	//Lecture de R	
-	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);
+		//Lecture de R	
+		req.data.id = 'R';
+		req.data.rtr = 1;
+		snd_dtq(CanTx, req.msg);
+		retour=periph[ADDR('R')].val; 
 	
-	retour=periph[ADDR('R')].val; 
+		//Asservissement
+		correction=5*(consigneT-retour);
+		comm.data.id='T';
+		comm.data.rtr = 0;
+		comm.data.val = correction;
 	
-	//Asservissement
-	correction=4*(consigne-retour);
-	comm.data.id='T';
-	comm.data.rtr = 0;
-	comm.data.val = correction;
-	
-	snd_dtq(CanTx,comm.msg);
-	dly_tsk(10);
+		snd_dtq(CanTx,comm.msg);
+		dly_tsk(10);
 	}
 
 }
@@ -169,30 +168,31 @@
 
 void position(){
 	CanFrame req;
-	UINT flag;
 	CanFrame comm;
-	unsigned short correction,Distance,consigne;
-	consigne=700;
+	unsigned short correction;
+	consigneP=700;
 	
 	while(1){
-			req.data.id = 'U';
-			req.data.rtr = 1;
-			snd_dtq(CanTx, req.msg);
-			Distance=periph[ADDR('U')].val; 
-		if(Distance>1500 || GEL==1){
+		req.data.id = 'U';
+		req.data.rtr = 1;
+		snd_dtq(CanTx, req.msg);
+		Distance=periph[ADDR('U')].val; 
+		if(Distance>1500 || GEL==1 || Distance<350){
 				comm.data.id='D';
 				comm.data.rtr = 0;
 				comm.data.val = 0;
+				LED_V=0;
 				dly_tsk(10);
 		}
 		else{
-				//Lecture de distance	
+				//Lecture de distance
+				LED_V=1;;	
 				req.data.id = 'U';
 				req.data.rtr = 1;
 				snd_dtq(CanTx, req.msg);
 				Distance=periph[ADDR('U')].val; 
 				//Asservissement
-				correction=1*(Distance-consigne);
+				correction=15/10*(Distance-consigneP);
 				comm.data.id='D';
 				comm.data.rtr = 0;
 				comm.data.val = correction;
@@ -200,38 +200,57 @@
 				snd_dtq(CanTx,comm.msg);
 				dly_tsk(10);
 		}
-			dly_tsk(10);
+		dly_tsk(10);
 	}	
 }
 
 void capteur(){
 	CanFrame req;
-	UINT flag;
 	CanFrame comm;
 	while (1){
+			GEL=0;
 			req.data.id = 'C';
 			req.data.rtr = 1;
 			snd_dtq(CanTx, req.msg);
 			capt=periph[ADDR('C')].val;
-			GEL=0;
-		while(capt==0x7610){
+			
+			//Circuit rouge
+		if(capt==0x6a02)commMoteur(10);	
+		if(capt==0x4203)commMoteur(30);
+
+		if(capt==0x7610 && GEL==0){
 			GEL=1;
+			LED_R=1;
+			commMoteur(44);
 			req.data.id = 'C';
 			req.data.rtr = 1;
 			snd_dtq(CanTx, req.msg);
 			capt=periph[ADDR('C')].val;
-			commMoteur(45);
-			comm.data.id='D';
-			comm.data.rtr = 0;
-			comm.data.val = 0;
-			snd_dtq(CanTx,comm.msg);
-			dly_tsk(100);
 		}
-	 dly_tsk(10);
+		
+		//Circuit noir
+		if(capt==0x5601) GEL=1;
+		if(capt==0x7600){
+			consigneP=950;
+		}
+		if(capt==0x4A01){
+			consigneP=700;
+	 
+		}
+		if(capt==0x7204)GEL=1;
+		dly_tsk(30);
 	}
 }
 		
-		
+/*char* nomPiste(){
+		CanFrame req;
+		req.data.id = 'M';
+		req.data.rtr = 1;
+		snd_dtq(CanTx, req.msg);
+		NomPiste=periph[ADDR('M')].val;
+		NomPiste=periph
+}
+	*/
 			
 void main()
 {
@@ -241,19 +260,19 @@
 	periph_nom("#BelinMob*");
 	can_init();
     clavier_init(1);
-	capture_init();
-
-
-
+	capture_init();
+	
+	lcd_str("antoine");
 	sta_tsk(ID_periph_rx);
 	sta_tsk(ID_tourelle);
 	sta_tsk(ID_position);
 	sta_tsk(ID_capteur);
-	dly_tsk(1500);
+	dly_tsk(500);
 	commMoteur(30);
 	
     while(1)
-    {
+    {
+		//nomPiste();
 		LED_J=1;
 		dly_tsk(100);
 		LED_J=0;
Index: branch/belin/Emb_App/DefaultSession.hsf
===================================================================
--- branch/belin/Emb_App/DefaultSession.hsf	(revision 347)
+++ branch/belin/Emb_App/DefaultSession.hsf	(revision 348)
@@ -33,6 +33,7 @@
 [CONFIG_INFO_VD4]
 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.03" 195 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
 "{WK_00000001_OUTPUT}" "WINDOW" 59422 0 0 "1.00" 195 0 0 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
 "{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 284 0 0 350 200 18 0 "" "0.0" 
@@ -54,12 +55,19 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
-"D:\laffont\Tp_Info14\Emb_App\programme_principal_etud.c" 
-"D:\laffont\Tp_Info14\Emb_App\uart0.c" 
-"D:\laffont\Tp_Info14\Emb_App\crt0mr.a30" 
-"D:\laffont\Tp_Info14\Emb_App\conf_noyau.cfg" 
-"D:\laffont\Tp_Info14\Emb_App\periph.c" 
-"D:\laffont\Tp_Info14\Emb_App\c_sec.inc" 
+"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 
+"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 
+"E:\tp_info_2018_belin\Emb_App\Debug\mr308.inc" 
+"E:\tp_info_2018_belin\Emb_App\conf_noyau.cfg" 
+"E:\tp_info_2018_belin\bsp\periph.c" 
+"E:\tp_info_2018_belin\Emb_App\Debug\kernel_id.h" 
+"E:\tp_info_2018_belin\bsp\uart0.c" 
+"E:\tp_info_2018_belin\bsp\dma0.c" 
+"E:\tp_info_2018_belin\bsp\radiocommande.c" 
+"E:\tp_info_2018_belin\bsp\mli.c" 
+"E:\tp_info_2018_belin\bsp\clavier.c" 
+"E:\tp_info_2018_belin\bsp\can.c" 
+"E:\tp_info_2018_belin\Emb_App\Debug\kernel_sysint.h" 
 [TARGET_NAME]
 "" "" 0 
 [STATUSBAR_STATEINFO_VD1]
