Index: branch/tchuem/Emb_App.tws
===================================================================
--- branch/tchuem/Emb_App.tws	(revision 276)
+++ branch/tchuem/Emb_App.tws	(revision 277)
@@ -9,6 +9,7 @@
 [OPEN_WORKSPACE_FILES]
 "E:\tp_info6_2018_tchuem\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_tchuem\tp_info6\bsp\radiocommande.c" 
+"E:\tp_info6_2018_tchuem\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\programme_principal_etud.c" 
@@ -15,9 +16,10 @@
 [WORKSPACE_FILE_STATES]
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\Debug\mr308.inc" 125 125 1430 351 0 4 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\crt0mr.a30" -8 -30 1596 539 1 0 
-"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\programme_principal_etud.c" 100 100 1430 351 0 3 
+"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 3 
 "E:\tp_info6_2018_tchuem\tp_info6\bsp\periph.c" 50 50 1430 351 0 1 
 "E:\tp_info6_2018_tchuem\tp_info6\bsp\radiocommande.c" 75 75 1430 351 0 2 
+"E:\tp_info6_2018_tchuem\tp_info6\bsp\uart0.c" 125 125 1430 351 0 5 
 [LOADED_PROJECTS]
 "EmbM32C87App" 
 [END]
Index: branch/tchuem/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_E8a_system.ini	(revision 276)
+++ branch/tchuem/Emb_App/SessionM32C_E8a_system.ini	(revision 277)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0022
+RESET=ff001e
Index: branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 276)
+++ branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 277)
@@ -29,9 +29,9 @@
 "{313F4FC1-6566-11D5-8BBE-0004E2013C71}TclTkCtrlLogFileName" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_END_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_COMPARE_START_ADDRESS" "" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_DEST_ADDRESS" "500" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_END_ADDRESS" "FFFFFF" 
-"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_START_ADDRESS" "000000" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_DEST_ADDRESS" "" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_END_ADDRESS" "" 
+"{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_DISPLAY_START_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_FILL_END_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_FILL_START_ADDRESS" "" 
 "{313F4FC2-6566-11D5-8BBE-0004E2013C71}ECX_MEMORY_MOVE_END_ADDRESS" "" 
@@ -83,7 +83,7 @@
 "{4B022541-3E95-11D7-909C-00201898052D}ElfDwarf2Objects" "1" 
 "{4B022541-3E95-11D7-909C-00201898052D}LoadModule0OBJ_ELFDWARF2_ARRAY_EXPAND_LIMIT" "-1" 
 "{4B022541-3E95-11D7-909C-00201898052D}LoadModule0OBJ_STATUS_OF_EBD_CMD" "0" 
-"{55384715-F881-421C-A548-D7D1ABE158E1}PDMRCtrlViews" "1" 
+"{55384715-F881-421C-A548-D7D1ABE158E1}PDMRCtrlViews" "0" 
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWnd0EnableRRam" "0" 
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWnd0MrType" "2" 
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWnd0MrType2ColumnSizeMode0Column0" "4" 
@@ -141,20 +141,20 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey0" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" 
 "{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" "0000000000004044" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000" 
+"{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" "0000000000FF0584" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000ABA" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "00000000000007F4" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000040" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0026" 
+"{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" 
@@ -169,12 +169,12 @@
 "{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" "0000000000000008" 
+"{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" "0000000000000AF0" 
-"{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" 
@@ -198,7 +198,7 @@
 "{AC411480-6F0A-11D5-8EB6-00004CC34E9D}ECX_IMAGE_SAMPLEING_RATE" "1000" 
 "{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}WatchCtrlViews" "0" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth0" "148" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth1" "186" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "200" 
@@ -243,7 +243,7 @@
 "{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC3" "0,0,1,0,1,0,1,0,0,0" 
 "{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_EVENT_BC4" "0,0,1,0,1,0,1,0,0,0" 
 "{D3D4595F-12B4-4866-8F9A-78C30AC967E3}T_SESSION_IS_SAVED" "YES" 
-"{D595F9C0-EF22-11D5-B7DB-0000E10B3DA9}EventCtrlViews" "2" 
+"{D595F9C0-EF22-11D5-B7DB-0000E10B3DA9}EventCtrlViews" "0" 
 "{D595F9C0-EF22-11D5-B7DB-0000E10B3DA9}EventWnd0ColWidth0" "40" 
 "{D595F9C0-EF22-11D5-B7DB-0000E10B3DA9}EventWnd0ColWidth1" "50" 
 "{D595F9C0-EF22-11D5-B7DB-0000E10B3DA9}EventWnd0ColWidth2" "280" 
@@ -277,11 +277,11 @@
 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.09" 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 0 "0.09" 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 2 "0.69" 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 1 "1.00" 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_system" "WINDOW" 59422 0 3 "0.10" 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 4 "0.09" 365 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32772|32773|<<separator>>|32786|<<separator>>|32810|32811" "0.0" 
@@ -311,9 +311,10 @@
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\programme_principal_etud.c" 
+"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_tchuem\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_tchuem\tp_info6\bsp\radiocommande.c" 
-"E:\tp_info6_2018_tchuem\tp_info6\bsp\periph.c" 
-"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_tchuem\tp_info6\bsp\uart0.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -360,5 +361,4 @@
 [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 96015936 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/tchuem/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tchuem/Emb_App/programme_principal_etud.c	(revision 276)
+++ branch/tchuem/Emb_App/programme_principal_etud.c	(revision 277)
@@ -120,20 +120,22 @@
 //'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 '*'
 
-float vitroue=23;
-float vittour=30;
 float A;
-//float B;
-float distance_mur=200;
+float C=600;
+float Dist; // distance mesurée par la tourelle
+float vit=5;
+
+
 
 void main()
 {
 	CanFrame co;
-	CanFrame demande,demande1;
-	CanFrame reponse,reponse1;
+	CanFrame demande1,demande;
+	CanFrame reponse1,reponse;
 	CanFrame co1;
 	CanFrame co2;
 	CanFrame co3;
+
 	
 	ports_mcu();
     lcd_init();
@@ -148,51 +150,41 @@
 	
 
 	sta_cyc(ID_acqui);
-//	sta_tsk(ID_periph_rx);
+	sta_tsk(ID_periph_rx);
+
+
+
+	
 
     while(1)
     {
-		co.data.id='T';
-		co.data.rtr=0;
-		co.data.val= vittour;
-		snd_dtq (CanTx,co.msg);
-		dly_tsk(1000);
-		
+	
 		demande.data.id='R';
-		demande.data.rtr=1;
-		snd_dtq (CanTx,demande.msg); 
- 		rcv_dtq (CanRx,&reponse.msg); 
-		A=reponse.data.val;
+		demande.data.rtr=1;
+		snd_dtq(CanTx, demande.msg);
+		//rcv_dtq(CanRx, &reponse.msg);
+		A= (C - periph[ADDR('R')].val);
 		
-		//dly_tsk(1000);
-		co1.data.id='V';
-		co1.data.rtr=0;
-		co1.data.val=vitroue;
-		dly_tsk(500);
-		snd_dtq (CanTx,co1.msg);
+		co1.data.id ='T';
+		co1.data.rtr =0;
+		co1.data.val = A;
+		snd_dtq(CanTx, co1.msg);
 		
 		demande1.data.id='U';
-		demande1.data.rtr=1;
-		snd_dtq (CanTx,demande1.msg); 
- 		rcv_dtq (CanRx,&reponse1.msg); 
-		//B=reponse1.data.val;
+		demande1.data.rtr=1;
+		snd_dtq(CanTx, demande1.msg);
+		Dist= periph[ADDR('U')].val;
 		
-		if (reponse1.data.val <400){
-			co2.data.id='D';
-			co2.data.rtr=0;
-			co2.data.val= -10*A;
-			dly_tsk(1000);
-			snd_dtq (CanTx,co2.msg);
+		co1.data.id ='D';
+		co1.data.rtr =0;
+		co1.data.val = 1*(Dist-580);
+		snd_dtq(CanTx, co1.msg);
 		
-			co2.data.id='D';
-			co2.data.rtr=0;
-			co2.data.val=0;
-			dly_tsk(100);
-			snd_dtq (CanTx,co2.msg);
-		}
-			
-		
-		
+		co1.data.id ='V';
+		co1.data.rtr =0;
+		co1.data.val =vit;
+		snd_dtq(CanTx, co1.msg);
+	
 		LED_J=1;
 		dly_tsk(100);
 		LED_J=0;
@@ -206,8 +198,16 @@
 	LED_V=!LED_V;
 
 }
+/*
+void asserv_tour(void)
+{
+	
+	demande.data.id='R';
+	demande.data.rtr=1;
+	snd_dtq(CanTx, demande.msg);
+	
+	A= C - periph[ADDR('R')].val;
+}
 
-
-	
-	
+*/	
 
