Index: branch/daval/Emb_App.tws
===================================================================
--- branch/daval/Emb_App.tws	(revision 500)
+++ branch/daval/Emb_App.tws	(revision 501)
@@ -25,8 +25,8 @@
 "E:\tp_info6_2018_daval\Emb_App\Debug\sys_rom.inc" 125 125 1430 351 0 11 
 "E:\tp_info6_2018_daval\Emb_App\conf_noyau.cfg" 0 0 1430 351 0 7 
 "E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 0 0 1596 539 0 1 
-"E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 0 
-"E:\tp_info6_2018_daval\bsp\lcd.c" 75 75 1430 351 0 9 
+"E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" 0 0 1596 539 0 0 
+"E:\tp_info6_2018_daval\bsp\lcd.c" -8 -30 1596 539 1 9 
 "E:\tp_info6_2018_daval\bsp\lcd.h" 100 100 1430 351 0 10 
 "E:\tp_info6_2018_daval\bsp\mli.c" 125 125 1430 351 0 5 
 "E:\tp_info6_2018_daval\bsp\periph.c" 50 50 1430 351 0 2 
Index: branch/daval/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/daval/Emb_App/SessionM32C_E8a_system.ini	(revision 500)
+++ branch/daval/Emb_App/SessionM32C_E8a_system.ini	(revision 501)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff004e
+RESET=ff0076
Index: branch/daval/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/daval/Emb_App/SessionM32C_E8a_system.hsf	(revision 500)
+++ branch/daval/Emb_App/SessionM32C_E8a_system.hsf	(revision 501)
@@ -196,8 +196,8 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey1" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system0" 
 "{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_1" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "000000000000000A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000009" 
 "{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" 
@@ -204,11 +204,11 @@
 "{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" "0000000000FF35D2" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF2E76" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000A96" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000089A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "000000000000FFFF" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000001256" 
+"{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" "00000000000000C0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
@@ -219,7 +219,7 @@
 "{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" "0000000000000000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000000004" 
 "{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" 
@@ -226,9 +226,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" "000000000000000A" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000120012" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A96" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000FF003C" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000001292" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "000000000000125C" 
 "{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" 
@@ -272,17 +272,19 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "numero, 2, 0, P, Col, Bin, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "capteur, 1, 0, P, Col, Bin, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "capteur, 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" "mode_course, 1, 0, P, Col, Bin, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007" "mode_course, 2, 0, P, Col, Bin, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "num_piste, 2, 0, P, Col, Bin, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "num_piste, 2, 0, P, Col, Hex, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009" "code_touche, 10, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010" "nbr_tour, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010_SCOPE" "Global," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "11" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0011" "feu_vert, 2, 0, P, Col, Bin, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0011_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "12" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -358,7 +360,7 @@
 "{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 3 "0.52" 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_system0" "WINDOW" 59422 0 1 "0.07" 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_PDMR}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 4 "0.01" 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_PDMR}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 4 "0.02" 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 5 "0.29" 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" 
@@ -385,16 +387,16 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
+"E:\tp_info6_2018_daval\bsp\lcd.c" 
+"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 
 "E:\tp_info6_2018_daval\Emb_App\programme_principal_etud.c" 
-"E:\tp_info6_2018_daval\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_daval\bsp\uart0.c" 
 "E:\tp_info6_2018_daval\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_daval\bsp\lcd.h" 
+"E:\tp_info6_2018_daval\Emb_App\Debug\sys_rom.inc" 
 "E:\tp_info6_2018_daval\Emb_App\Debug\mr308.inc" 
-"E:\tp_info6_2018_daval\Emb_App\Debug\sys_rom.inc" 
-"E:\tp_info6_2018_daval\bsp\lcd.c" 
 "E:\tp_info6_2018_daval\bsp\radiocommande.c" 
 "E:\tp_info6_2018_daval\bsp\periph.c" 
-"E:\tp_info6_2018_daval\bsp\uart0.c" 
 "E:\tp_info6_2018_daval\Emb_App\Debug\mrtable.a30" 
 "E:\tp_info6_2018_daval\bsp\mli.c" 
 [TARGET_NAME]
@@ -443,5 +445,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 93137240 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 91367768 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/daval/Emb_App/programme_principal_etud.c
===================================================================
--- branch/daval/Emb_App/programme_principal_etud.c	(revision 500)
+++ branch/daval/Emb_App/programme_principal_etud.c	(revision 501)
@@ -138,7 +138,7 @@
 
 //Variables pour les capteurs
 
-int capteur;
+unsigned short capteur;
 char couleur;
 char numero;
 
@@ -145,11 +145,16 @@
 //Variables pour les pistes
 char num_piste;
 unsigned short nbr_tour=0;
+
 // Gestion piste et feu
 
-int mode_course;
+unsigned short mode_course;
 char feu_vert;
 
+//Gestion nombre de tour
+int i=0;
+char nb_tour=0;
+
 void mode2course(){				//Recuperation de l'info sur la couleur du feu et de la piste sur laquelle on est
 	CanFrame requete;
 	UINT flag;
@@ -163,31 +168,8 @@
         mode_course = periph[ADDR('M')].val;
 		feu_vert = (mode_course>>15)&& 0x01;
 		num_piste = mode_course;
-		switch(num_piste)
-		{
-			case 0x01 :
-				lcd_init();
-				lcd_com(0x80);
-				lcd_str("vert");
-			break;
-			case 0x02 :
-				lcd_init();
-				lcd_com(0x80);
-				lcd_str("bleu");
-			break;
-			case 0x01 :
-				lcd_init();
-				lcd_com(0x80);
-				lcd_str("rouge");
-			break;
-			case 0x01 :
-				lcd_init();
-				lcd_com(0x80);
-				lcd_str("noir");
-			break;
-		}
         dly_tsk(20);
-        }
+    }
 }
 
 void asservissement_tourelle()
@@ -225,18 +207,15 @@
 {
 	
 	dly_tsk(2000);
-	//if(feu_vert==1)
-	//{
-		
 	
 		vitesse.data.id='V';				//Envoi d'une commande en vitesse
-		vitesse.data.rtr=0; 				//Indique une ecritur
+		vitesse.data.rtr=0; 				//Indique une ecriture
 		while(1)
 		{
-			switch(num_piste)
+			switch(num_piste)				//Envoi des différentes consignes de vitesse en fonction du numero de la piste
 			{
-				case 1:	 vitesse_rapide= 65;
-						 vitesse_lente=35; 
+				case 1:	 vitesse_rapide= 70;
+						 vitesse_lente=30; 
 			    break;
 						
 				case 2:  vitesse_rapide= 40;
@@ -271,17 +250,22 @@
 				vitesse.data.val=10;
 				snd_dtq (CanTx,vitesse.msg);
 			}
-			/*if(capteur == 0b0101011000000101) //Compte le nombre de tour au bout de trois la voiture s'arrête
-			{
-				
-				nbr_tour+=1;
-				if(nbr_tour==3)
+			/*if (capteur==0x5605 && i==0)			//Comptage des tours : utilisation de deux variables sinon ca ne fonctionne pas, on incremente pas de 1 a chaque tour
+		    {
+				i++;
+            	nb_tour++;
+            	if (nb_tour>=3)
 				{
-					vitesse.data.val=0;
+					vitesse_rapide=0;
+					vitesse_lente=0; 
+                	vitesse.data.val=vitesse_rapide;
 					snd_dtq (CanTx,vitesse.msg);
-					
 				}
-			}*/
+			}
+        	if (capteur==0x5601 && i!=0)
+			{
+				i=0;                
+			}      */  
 			while(Bp_G==1)
 			{
 				vitesse.data.val=0;
@@ -291,7 +275,6 @@
 			dly_tsk(15);
 		}
 		dly_tsk(10);
-	//}
 }
 
 void distance_bord()
@@ -349,7 +332,8 @@
 	}
 }
 
-void detection_capteur(){
+void detection_capteur()
+{
 	CanFrame requete;
 	UINT flag;
 	while(1)
@@ -362,67 +346,90 @@
         capteur = periph[ADDR('C')].val;
         couleur = capteur >> 8;				//On decale pour avoir les 8 bits de poids forts : info sur la couleur
 		numero = capteur ;
-		switch(capteur)
+		dly_tsk(15);        
+	}
+}
+
+void affichage_lcd()
+{
+	while(1)	
+	{
+		switch(capteur)				//aAffichage la couleur du capteur sur 
 		{
 			case 0x5601 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("vert");
+				lcd_str("cap vert");
 			break;
 			case 0x4a01 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("jaune");
+				lcd_str("cap jaune");
 			break;
 			case 0x5602 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("vert");
+				lcd_str("cap vert");
 			break;
 			case 0x5202 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("rouge");
+				lcd_str("cap rouge");
 			break;
 			case 0x5603 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("vert");
+				lcd_str("cap vert");
 			break;
 			case 0x4203 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("bleu");
+				lcd_str("cap bleu");
 			break;
 			case 0x5604 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("vert");
+				lcd_str("cap vert");
 			break;
 			case 0x4304 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("cyan");
+				lcd_str("cap cyan");
 			break;
 			case 0x5605 :
 				lcd_init();
 				lcd_com(0xC0);
-				lcd_str("vert");
+				lcd_str("cap vert");
 			break;
+			
 		}
-        dly_tsk(15);
-        }
-}
-
-void clavier()
-{
-	while(1)
-	{
-		short code_touche;
-		vrcv_dtq(QdmTouche,&code_touche);
-		
+		switch(num_piste)
+		{
+			case 0x01 :
+				lcd_init();
+				lcd_com(0x80);
+				lcd_str("p vert");
+			break;
+			case 0x02 :
+				lcd_init();
+				lcd_com(0x80);
+				lcd_str("p bleu");
+			break;
+			case 0x03 :
+				lcd_init();
+				lcd_com(0x80);
+				lcd_str("p rouge");
+			break;
+			case 0x04 :
+				lcd_init();
+				lcd_com(0x80);
+				lcd_str("p noir");
+			break;
+		}
 	}
-	dly_tsk(25);
+	
+	
+	dly_tsk(15);
 }
 
 void main()
@@ -447,7 +454,7 @@
 	sta_tsk(ID_avance);
 	sta_tsk(ID_detection_capteur);
 	sta_tsk(ID_mode2course);
-	sta_tsk(ID_clavier);
+	sta_tsk(ID_affichage_lcd);
 	while(1);
 
 }
@@ -454,8 +461,14 @@
 
 void acqui()
 {
-	LED_V=!LED_V;
-	LED_R=!LED_R;
-	LED_J=!LED_J;
+//	LED_V=!LED_V;
+	if(Bp_G==1)
+	{
+		LED_R =1;
+	}
+	else
+	{
+		LED_R =0;
+	}
 }
 
Index: branch/daval/Emb_App/conf_noyau.cfg
===================================================================
--- branch/daval/Emb_App/conf_noyau.cfg	(revision 500)
+++ branch/daval/Emb_App/conf_noyau.cfg	(revision 501)
@@ -119,8 +119,8 @@
 	exinf	= 0x0;
 };
 task[]{
-	entry_address	= clavier();
-	name	= ID_clavier;
+	entry_address	= affichage_lcd();
+	name	= ID_affichage_lcd;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 10;
