Index: branch/tchuem/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_E8a_system.ini	(revision 541)
+++ branch/tchuem/Emb_App/SessionM32C_E8a_system.ini	(revision 542)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0036
+RESET=ff0056
Index: branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 541)
+++ branch/tchuem/Emb_App/SessionM32C_E8a_system.hsf	(revision 542)
@@ -141,8 +141,8 @@
 "{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" "0000000000000008" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "000000000000014D" 
 "{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" 
@@ -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" "0000000000FF058A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF1EC1" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000ABE" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "00000000000007F8" 
-"{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_18" "0000000000001276" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000898" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004040" 
 "{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" 
@@ -171,9 +171,9 @@
 "{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_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" "0000000000000AF4" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000004" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "00000000000013CC" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000001294" 
 "{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" 
@@ -198,19 +198,31 @@
 "{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" "0" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth0" "148" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth1" "186" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "200" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchCtrlViews" "4" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth0" "120" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth1" "150" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth12" "150" 
 "{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" "dma0_fin_tr, 2, 0, P, Col, Hex, MN" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "Dist, 3, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "0" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "Tourne, 3, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "Vitesse, 3, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "couleur, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "feu, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "cleur, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "temps, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006_SCOPE" "Global," 
+"{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" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth3" "200" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ECX_WATCH" "" 
@@ -217,7 +229,7 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ECX_WATCH_ITEMCnt" "0" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth1" "150" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth12" "200" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth12" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ColWidth3" "200" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ECX_WATCH" "" 
@@ -224,7 +236,7 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd2ECX_WATCH_ITEMCnt" "0" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth1" "150" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth12" "200" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth12" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ColWidth3" "200" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd3ECX_WATCH" "" 
@@ -268,9 +280,9 @@
 [LANGUAGE]
 "English" 
 [CONFIG_INFO_VD1]
+0 
+[CONFIG_INFO_VD2]
 1 
-[CONFIG_INFO_VD2]
-0 
 [CONFIG_INFO_VD3]
 0 
 [CONFIG_INFO_VD4]
@@ -281,10 +293,10 @@
 "{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 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_OUTPUT}" "WINDOW" 59422 0 1 "0.74" 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" 
+"{WK_00000001_WATCH}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 2 "0.26" 365 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32772|32773|<<separator>>|32786|<<separator>>|32810|32811" "0.0" 
 "{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 308 0 0 350 200 18 0 "" "0.0" 
 "{WK_TB00000001_STANDARD}" "TOOLBAR 0" 59419 0 2 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
 "{WK_TB00000002_EDITOR}" "TOOLBAR 0" 59419 0 0 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
@@ -306,12 +318,39 @@
 "{WK_TB00000028_RTOSDEBUG}" "TOOLBAR 0" 59419 2 2 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000029_SYSTEMTOOL}" "TOOLBAR 0" 59419 2 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 [WINDOW_POSITION_STATE_DATA_VD2]
+"Help" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_00000001_CmdLine}" "WINDOW" 59422 0 0 "0.07" 365 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 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_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 308 0 0 350 200 18 0 "" "0.0" 
+"{WK_TB00000001_STANDARD}" "TOOLBAR 0" 59419 0 2 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000002_EDITOR}" "TOOLBAR 0" 59419 0 0 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000003_BOOKMARKS}" "TOOLBAR 0" 59419 1 1 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000004_TEMPLATES}" "TOOLBAR 0" 59419 1 0 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000005_SEARCH}" "TOOLBAR 0" 59419 0 1 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000007_DEBUG}" "TOOLBAR 0" 59419 2 0 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000008_DEBUGRUN}" "TOOLBAR 0" 59419 2 1 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000009_VERSIONCONTROL}" "TOOLBAR 0" 59419 1 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000011_CPU}" "TOOLBAR 0" 59419 2 5 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000012_MAP}" "TOOLBAR 0" 59419 1 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000013_SYMBOL}" "TOOLBAR 0" 59419 2 6 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000014_CODE}" "TOOLBAR 0" 59419 2 7 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000016_GRAPHIC}" "TOOLBAR 0" 59419 2 8 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000018_DEFAULTWINDOW}" "TOOLBAR 0" 59419 1 2 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000023_RTOS}" "TOOLBAR 0" 59419 2 9 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000026_MACRO}" "TOOLBAR 0" 59419 1 5 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000028_RTOSDEBUG}" "TOOLBAR 0" 59419 2 2 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000029_SYSTEMTOOL}" "TOOLBAR 0" 59419 2 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\programme_principal_etud.c" 
+"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_tchuem\tp_info6\Emb_App\Debug\mr308.inc" 
 "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\bsp\uart0.c" 
+"E:\tp_info6_2018_tchuem\tp_info6\bsp\lcd.c" 
+"E:\tp_info6_2018_tchuem\tp_info6\Emb_App\crt0mr.a30" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
Index: branch/tchuem/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tchuem/Emb_App/programme_principal_etud.c	(revision 541)
+++ branch/tchuem/Emb_App/programme_principal_etud.c	(revision 542)
@@ -123,12 +123,14 @@
 
 float C=600;
 float Dist; // distance mesurée par la tourelle
-float Vitesse=39; //23 //40
+float Vitesse=26; //23 //40
 float Tourne;
 float Trou;
 int num_capt1[];
 int num_capt2[];
 int trou;
+
+int couleur_capteur='V';
  
 unsigned char couleur;
 unsigned char feu;
@@ -159,7 +161,7 @@
 	ports_mcu();
     lcd_init();
 	periph_init();
-	periph_nom("#AutoTest*");
+	periph_nom("#aurel*");
 
     can_init();
 
@@ -176,7 +178,6 @@
 	sta_tsk(ID_detect_trou);
 	sta_tsk(ID_vit);
 	sta_tsk(ID_piste);
-	sta_tsk(ID_depart);
 	
 	switch(cleur){
 		
@@ -190,6 +191,23 @@
 		break;
 	}
 	
+	switch(couleur_capteur){
+		case('V') : lcd_str("VERT|");
+		break;
+		case('B') : lcd_str("BLEU|");
+		break;
+		case('R') : lcd_str("ROUGE|");
+		break;
+		case('J') : lcd_str("JAUNE|");
+		break;
+		case('C') : lcd_str("CYAN|");
+		break;
+		}
+	
+	lcd_putc(temps);
+	
+	sta_tsk(ID_depart);
+	
 		
 
     while(1)
@@ -276,18 +294,19 @@
 	
 		Dist= periph[ADDR('U')].val;
 		Tourne= Dist- 580;
+		
+		if (periph[ADDR('U')].val > 1600){
+			
+ 			Dist = periph[ADDR('U')].val;
+			Tourne=0;
+		}
+		if (periph[ADDR('U')].val > 2000){
+			
+ 			LED_J=1;
+			dly_tsk(100);
+		}
 
 	
-		if (Dist >1000){
-			
-			Tourne =0;
-			co.data.id ='D';
-			co.data.rtr =0;
-			co.data.val = 0;
-			snd_dtq(CanTx, co.msg);
-			dly_tsk(25);  //25
-			
-		}
 		
 		
 		while (Bp_M == 1)
@@ -304,7 +323,8 @@
 			co.data.val =Dist -580;
 			snd_dtq(CanTx, co.msg);
 			dly_tsk(5);
-		}	
+		}
+		
 	
 	
 	
@@ -316,14 +336,47 @@
 		dly_tsk(25); //25
 	}
 }
+
+/*void vit_rouge()
+{
+	co.data.id ='V';
+	co.data.rtr =0;
+	co.data.val = Vitesse;
+	snd_dtq(CanTx, co.msg);
+	dly_tsk(10); //10
+	
+	demande.data.id='C';
+	demande.data.rtr=1;
 		
+	snd_dtq (CanTx,demande.msg); // demande couleur capteur
+	//Couleurperso = periph[ADDR('C')].val;
+	capteur= periph[ADDR('C')].val>>2;
+		
+	//infCaptprec = infCapt;
+	couleur_capteur = periph[ADDR('C')].val>>8;
 	
+	if (couleur_capteur='R')
+	{
+		co.data.id ='V';
+		co.data.rtr =0;
+		co.data.val = 32;
+		
+		co.data.id ='D';
+		co.data.rtr =0;
+		co.data.val = 0;
+	}
+		
+	*/	
+	
+	
+		
+	
 void vit()
 {
 	
 	while(1)
 	{
-	/*
+	
 		while (Bp_G == 1)
 		{
 			
@@ -331,6 +384,7 @@
 			co.data.rtr =0;
 			co.data.val =0;
 			snd_dtq(CanTx, co.msg);
+			LED_R=1;
 			
 		}
 		
@@ -346,27 +400,8 @@
 		co.data.rtr =1;
 		snd_dtq(CanTx, co.msg);
 		dly_tsk(5);
+		
 	
-		feu=(periph[ADDR('M')].val);
-		feu=feu&0x8000;
-		if(feu==1)
-		{
-			demande.data.id ='V';
-			demande.data.rtr =0;
-			demande.data.val =Vitesse;
-			snd_dtq(CanTx, demande.msg);
-			
-		}
-		
-		else
-		{
-			demande.data.id ='V';
-			demande.data.rtr =0;
-			demande.data.val = Vitesse;
-			snd_dtq(CanTx, demande.msg);
-		
-		}
-	*/
 		co.data.id ='V';
 		co.data.rtr =0;
 		co.data.val = Vitesse;
@@ -373,6 +408,8 @@
 		snd_dtq(CanTx, co.msg);
 		dly_tsk(10); //10*/
 		
+		
+		
 	}
 	
 }
@@ -407,18 +444,46 @@
 		demande.data.id='M';
 		demande.data.rtr=1;
 		snd_dtq(CanTx,demande.msg);
+		dly_tsk(10);
 	
 		couleur= periph[ADDR('M')].val;
 		cleur=couleur&0x000F;
+		/*switch(cleur){
 		
+		case 1: lcd_str("verte");
+		break; 
+		case 2: lcd_str("bleue"); 
+		break; 
+		case 3: lcd_str("rouge"); 
+		break;
+		case 4: lcd_str("noire");
+		break;
+	}*/
+		demande.data.id='C';
+		demande.data.rtr=1;
 		
+		snd_dtq (CanTx,demande.msg); // demande couleur capteur
+		//Couleurperso = periph[ADDR('C')].val;
+		//capteur= periph[ADDR('C')].val>>2;
 		
+		
+		couleur_capteur = periph[ADDR('C')].val>>8;
+		
+		
+		
 		demande.data.id='H';
 		demande.data.rtr=1;
 		snd_dtq(CanTx,demande.msg);
 	
 		temps= periph[ADDR('H')].val;
+		//lcd_putc(temps);
 		dly_tsk(10);
+		
+		
+		while (Bp_D==1)
+		{
+			lcd_init();
+		}
 	}
 	
 }
@@ -433,11 +498,18 @@
 		snd_dtq(CanTx,demande.msg);
 	
 		feu= periph[ADDR('M')].val;
-		feu=feu&0x8000;
 		feu=feu>>15;
 		dly_tsk(10);
-		
-		
+
+		if(feu==1){
+			Vitesse=0;
+
+			demande.data.id='V';
+			demande.data.rtr=0;
+			demande.data.val=Vitesse;
+	
+			snd_dtq (CanTx,demande.msg);
+		}		
 	}
 }
 		
