Index: branch/schiano/Emb_App.tws
===================================================================
--- branch/schiano/Emb_App.tws	(revision 373)
+++ branch/schiano/Emb_App.tws	(revision 374)
@@ -7,17 +7,21 @@
 [GENERAL_DATA]
 [BREAKPOINTS]
 [OPEN_WORKSPACE_FILES]
+"E:\tp_info6_2018_schiano\tp_info6\bsp\lcd.c" 
 "E:\tp_info6_2018_schiano\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_schiano\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\kernel_id.h" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\kernel_id.h" 25 25 1405 419 0 7 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 125 125 1405 363 0 5 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 25 25 1430 351 0 1 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 0 0 1596 539 0 2 
-"E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 576 1 0 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 632 1 0 
+"E:\tp_info6_2018_schiano\tp_info6\bsp\lcd.c" 0 0 1405 419 0 6 
 "E:\tp_info6_2018_schiano\tp_info6\bsp\periph.c" 175 175 1405 363 0 4 
 "E:\tp_info6_2018_schiano\tp_info6\bsp\uart0.c" 150 150 1405 363 0 3 
 [LOADED_PROJECTS]
Index: branch/schiano/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/schiano/Emb_App/SessionM32C_E8a_system.ini	(revision 373)
+++ branch/schiano/Emb_App/SessionM32C_E8a_system.ini	(revision 374)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0044
+RESET=ff007a
Index: branch/schiano/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/schiano/Emb_App/SessionM32C_E8a_system.hsf	(revision 373)
+++ branch/schiano/Emb_App/SessionM32C_E8a_system.hsf	(revision 374)
@@ -141,7 +141,7 @@
 "{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" "0000000000000001" 
+"{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" 
@@ -148,13 +148,13 @@
 "{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" "0000000000FF322B" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000AB2" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "00000000000008B6" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "000000000000FFFF" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C1" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF007A" 
+"{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" "000000000000000A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "00000000000CE4F6" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000AB2" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
+"{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" "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" 
@@ -219,23 +219,23 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "angleRoue, 2, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007" "a, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007" "a, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "b, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "b, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009" "c, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009" "c, 1, 0, P, Col, Hex, MN" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010" "vitesselignedroite, 2, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010" "tours, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0011" "feuvert, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0011" "cpt, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0011_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0012" "d, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0012" "clavier, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0012_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0013" "e, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0013" "infCapt, 1, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0013_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0014" "numero, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0014_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "12" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "14" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -305,14 +305,14 @@
 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 4 "0.07" 328 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 2 "0.07" 272 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.06" 328 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0" 
+"{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 1 "0.04" 272 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 "0.58" 328 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.08" 328 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_OUTPUT}" "WINDOW" 59422 0 0 "0.70" 272 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 4 "0.06" 272 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 2 "0.29" 328 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 3 "0.20" 272 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" 
@@ -339,10 +339,12 @@
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 
-"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_schiano\tp_info6\bsp\uart0.c" 
+"E:\tp_info6_2018_schiano\tp_info6\bsp\lcd.c" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 
-"E:\tp_info6_2018_schiano\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_schiano\tp_info6\bsp\periph.c" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\kernel_id.h" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -389,5 +391,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 79192808 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 103162224 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/schiano/Emb_App/programme_principal_etud.c
===================================================================
--- branch/schiano/Emb_App/programme_principal_etud.c	(revision 373)
+++ branch/schiano/Emb_App/programme_principal_etud.c	(revision 374)
@@ -131,7 +131,11 @@
 unsigned int vitesselignedroite =0;
 unsigned int vitessevirage =0;
 unsigned int erreurprec=0;
+unsigned int tempstours=0;
+unsigned int cpt=0;
 
+int jeton=0;
+int tours=0;
 int etatfeu=0;
 int feuvert=0;
 int go=0;
@@ -139,9 +143,17 @@
 int Couleurperso =0;
 int consigneVitesse;
 int CouleurCapteur ='V';
+int infCapt='V';
+int infCaptprec;
 int k=2;
-int kp=1;
+
+float kp=1;
 float kpi=1/2;
+int urgence=0;
+int AUR=0;
+
+short touche;
+short clavier;
 
 void main()
 {
@@ -161,11 +173,9 @@
 	sta_tsk(ID_periph_rx);
 	sta_cyc(ID_asservtourellecyc); //asservissement telemetre
 	sta_tsk(ID_asservtourelle);
-	
 	
 	sta_tsk(ID_asservRoue);
 	
-
 	sta_tsk(ID_numpiste);
 	while(go!=1); //attente detection de la piste
 	
@@ -187,7 +197,10 @@
 		case(1024) : //noir
 		sta_tsk(ID_AsservVitesseN);
 		break;
-	}
+	}
+	sta_cyc(ID_tour);
+	sta_tsk(ID_ArretUrgence);
+	sta_tsk(ID_ecran);
    while(1)
     {
     }
@@ -217,7 +230,9 @@
 			consignedistance = 785;
 			distancemur = consignedistance;
 			sta_cyc(ID_asservangleroue); //assservissement angle roue
+			kp =1,2;
 			go =1;
+			
 			break;
 		
 			case(512) : //bleue
@@ -354,6 +369,7 @@
 void asservangleroueN(){ 
 	if(Couleurperso==0x76c0);
 	else if(Couleurperso==0x62c0);
+	else if(Couleurperso==0x62f8);
 	else if(Couleurperso==0x62f0);
 	else {
 		angleRoue= -kp*(consignedistance - distancemur)-kpi*erreurprec;
@@ -372,11 +388,15 @@
 		snd_dtq (CanTx,demandeCapteur.msg); // demande couleur capteur
 		Couleurperso = periph[ADDR('C')].val;
 		CouleurCapteur = periph[ADDR('C')].val>>2;
+		infCaptprec = infCapt;
+		infCapt = periph[ADDR('C')].val>>8;
+		if((infCapt!='V')&&(infCapt!='R')&&(infCapt!='J')&&(infCapt!='B')&&(infCapt!='C'))infCapt=infCaptprec;
+		
 		if ((CouleurCapteur == 0x1580)||(CouleurCapteur == 0x1581)||(CouleurCapteur == 0x1da0)) {
-			consigneVitesse = vitesselignedroite;
+				consigneVitesse = vitesselignedroite;	
 		}
 		else {
-			consigneVitesse = vitessevirage;
+				consigneVitesse = vitessevirage;
 		}
 		
 		vitesse.data.id='V';
@@ -401,9 +421,12 @@
 		snd_dtq (CanTx,demandeCapteur.msg); // demande couleur capteur
 		Couleurperso = periph[ADDR('C')].val;
 		CouleurCapteur = periph[ADDR('C')].val>>2;
-		if ((CouleurCapteur == 0x1580)||(CouleurCapteur == 0x1581)||(CouleurCapteur == 0x1da0)) {
-			consigneVitesse = vitesselignedroite;
-		}
+		
+		infCaptprec = infCapt;
+		infCapt = periph[ADDR('C')].val>>8;
+		if((infCapt!='V')&&(infCapt!='R')&&(infCapt!='J')&&(infCapt!='B')&&(infCapt!='C'))infCapt=infCaptprec;
+		
+		if ((CouleurCapteur == 0x1580)||(CouleurCapteur == 0x1581)||(CouleurCapteur == 0x1da0))consigneVitesse = vitesselignedroite;
 		else {
 			if(Couleurperso == 0x7601){
 				consigneVitesse = 45;
@@ -434,28 +457,11 @@
 		
 		snd_dtq (CanTx,demandeCapteur.msg); // demande couleur capteur
 		Couleurperso = periph[ADDR('C')].val;
-		CouleurCapteur = periph[ADDR('C')].val>>2;
-		/*if ((CouleurCapteur == 0x1580)||(CouleurCapteur == 0x1581)||(CouleurCapteur == 0x1da0)||(CouleurCapteur==0x1db0)) {
-			if(Couleurperso==0x5603) consigneVitesse = 70; //ligne droite apres bosse
-			else if(Couleurperso ==0x5604) {//ligne droite dans la terre
-				consigneVitesse =15;
-				consignedistance = 500;
-			}
-			else consigneVitesse = vitesselignedroite;
-		}
-		else {
-			if(Couleurperso == 0x6a01)consignedistance = 925; //decalage pour le tonneau au millieu
-			else if (Couleurperso == 0x4a01) consignedistance = 700;//retour au centre de la piste
-			else if(Couleurperso==0x62f0) consigneVitesse = 40; //2e montee
-			else if(Couleurperso==0x5202) consigneVitesse = 25; //virage apres la bosse
-			else if(Couleurperso==0x4304){//dernier virage
-				consigneVitesse =30;
-				consignedistance=700; 
-			}
-			else {consigneVitesse = vitessevirage;
-				}
-		}*/
 		
+		infCaptprec = infCapt;
+		infCapt = periph[ADDR('C')].val>>8;
+		if((infCapt!='V')&&(infCapt!='R')&&(infCapt!='J')&&(infCapt!='B')&&(infCapt!='C'))infCapt=infCaptprec;
+		
 		switch (Couleurperso){
 			case(0x76c0) : consigneVitesse = 35; break;
 			case(0x6a01) : consignedistance = 925; break; //decalage pour le tonneau au millieu
@@ -462,12 +468,13 @@
 			case(0x4a01) : consignedistance = 700; break; //1er virage
 			case(0x5602) : consigneVitesse = vitessevirage; break;
 			case(0x62c0) : consigneVitesse = 12; break;
+			case(0x62f8) : ;break;
 			case(0x6a02) : consigneVitesse = 12; break;
 			case(0x6a06) : consigneVitesse = vitessevirage; break;
 			case(0x5202) : consigneVitesse = 25; break; //virage apres la bosse
 			case(0x5603) : consigneVitesse = 70; break; //ligne droite apres bosse
 			case(0x62f0) : consigneVitesse = vitesselignedroite; break; //2e montee
-			case(0x4203) : consigneVitesse = 25; break;
+			case(0x4203) : consigneVitesse = 20; break;
 			case(0x5604) : //ligne droite dans la terre
 				consigneVitesse =15;
 				consignedistance = 500;
@@ -477,17 +484,8 @@
 				consignedistance=700; 
 			break;
 		
-		}
+		}	
 		
-		
-		
-		
-		
-		
-		
-		
-		
-		
 		vitesse.data.id='V';
 		vitesse.data.rtr=0;
 		vitesse.data.val=consigneVitesse; //consigne de vitesse de la voiture
@@ -496,4 +494,98 @@
 		
 		dly_tsk(30);
 	}
-}
\ No newline at end of file
+}
+
+void tour(){
+	CanFrame vitesse;
+
+	
+	if(Couleurperso==0x5605){
+		jeton=1;
+	}
+	if((Couleurperso!=0x5605)&&(jeton==1)){
+		tours++;
+		jeton=0;
+	}
+	
+	if (tours==3){
+		vitesse.data.id='V';
+		vitesse.data.rtr=0;
+		vitesse.data.val=0;
+
+		snd_dtq (CanTx,vitesse.msg);
+		
+		isus_tsk(ID_asservtourelle);
+		isus_tsk(ID_asservRoue);
+		isus_tsk(ID_AsservVitesse);
+		isus_tsk(ID_AsservVitesseR);
+		isus_tsk(ID_AsservVitesseN);
+	}
+		
+}
+
+void idle(){
+	while(1){
+		cpt++;
+		dly_tsk(1);
+	}
+}
+
+void ArretUrgence(){
+	CanFrame vitesse;
+	
+	while(1){
+		if(Bp_G==1)urgence=1;
+		else urgence =0;
+			
+		if(urgence==1){
+			vitesse.data.id='V';
+			vitesse.data.rtr=0;
+			vitesse.data.val=0;
+
+			snd_dtq (CanTx,vitesse.msg);
+		
+			sus_tsk(ID_asservtourelle);
+			sus_tsk(ID_asservRoue);
+			sus_tsk(ID_AsservVitesse);
+			sus_tsk(ID_AsservVitesseR);
+			sus_tsk(ID_AsservVitesseN);
+			AUR=1;
+		}
+		if((urgence==0)&&(AUR!=0)){
+			rsm_tsk(ID_asservtourelle);
+			rsm_tsk(ID_asservRoue);
+			rsm_tsk(ID_AsservVitesse);
+			rsm_tsk(ID_AsservVitesseR);
+			rsm_tsk(ID_AsservVitesseN);
+
+		}
+		dly_tsk(10);
+	}	
+}
+
+void ecran(){
+	while(1){
+		dly_tsk(250);
+		lcd_init();
+		switch(numero){
+			case(256) : lcd_str("VERT|"); break;
+			case(512) : lcd_str("BLEU|"); break;
+			case(768) : lcd_str("ROUGE|"); break;
+			case(1024) : lcd_str("NOIR|"); break;
+		}
+		switch(infCapt){
+			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;
+		}
+	}
+}
+/*void decode_int(void){
+  
+	vrcv_dtq(QdmTouche,&touche);
+	clavier = touche-48; //touche en ASCII
+            
+}*/
\ No newline at end of file
Index: branch/schiano/Emb_App/conf_noyau.cfg
===================================================================
--- branch/schiano/Emb_App/conf_noyau.cfg	(revision 373)
+++ branch/schiano/Emb_App/conf_noyau.cfg	(revision 374)
@@ -122,7 +122,18 @@
 	exinf	= 0x0;
 };
 
+
 task[]{
+	entry_address	= ArretUrgence();
+	name	= ID_ArretUrgence;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 6;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
 	entry_address	= AsservVitesseN();
 	name	= ID_AsservVitesseN;
 	stack_size	= 256;
@@ -132,6 +143,28 @@
 	exinf	= 0x0;
 };
 
+task[]{
+	entry_address	= ecran();
+	name	= ID_ecran;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+
+task[]{
+	entry_address	= idle();
+	name	= ID_idle;
+	stack_size	= 512;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= ON;
+	exinf	= 0x0;
+};
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
@@ -195,7 +228,7 @@
 	exinf	= 0x0;
 	start	= OFF;
 	phsatr	= OFF;
-	interval_counter	= 10;
+	interval_counter	= 7;
 	phs_counter	= 0x0;
 };
 
@@ -205,7 +238,7 @@
 	exinf	= 0x0;
 	start	= OFF;
 	phsatr	= OFF;
-	interval_counter	= 10;
+	interval_counter	= 7;
 	phs_counter	= 0x0;
 };
 
@@ -215,10 +248,20 @@
 	exinf	= 0x0;
 	start	= OFF;
 	phsatr	= OFF;
-	interval_counter	= 10;
+	interval_counter	= 7;
 	phs_counter	= 0x0;
 };
 
+cyclic_hand[]{
+	entry_address	= tour();
+	name	= ID_tour;
+	exinf	= 0x0;
+	start	= OFF;
+	phsatr	= OFF;
+	interval_counter	= 250;
+	phs_counter	= 0x0;
+};
+
 vdataqueue[]{
 	name	= QdmTouche;
 	wait_queue	= TA_TFIFO;
