Index: branch/beaussant/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/beaussant/Emb_App/SessionM32C_E8a_system.ini	(revision 508)
+++ branch/beaussant/Emb_App/SessionM32C_E8a_system.ini	(revision 509)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0064
+RESET=ff0066
Index: branch/beaussant/Emb_App/crt0mr.a30
===================================================================
--- branch/beaussant/Emb_App/crt0mr.a30	(revision 508)
+++ branch/beaussant/Emb_App/crt0mr.a30	(revision 509)
@@ -97,7 +97,7 @@
 ; after reset,this program will start
 ;-----------------------------------------------------------------
 __SYS_INITIAL:
-	LDC	#__Sys_Sp,ISP	; set initial ISPl
+  LDC	#__Sys_Sp,ISP	; set initial ISPl
 
 	MOV.B	#2,0AH
 	MOV.B	#00,PMOD		; Set Processor Mode Register
Index: branch/beaussant/Emb_App/programme_principal_etud.c
===================================================================
--- branch/beaussant/Emb_App/programme_principal_etud.c	(revision 508)
+++ branch/beaussant/Emb_App/programme_principal_etud.c	(revision 509)
@@ -128,7 +128,7 @@
 int commandeR=0;
 short consigne=450;
 int dist_obs=0;
-int dist_consigne=702;
+int dist_consigne=699;
 int cmpt;
 char kt=3;
 int borne=0;
@@ -141,6 +141,7 @@
 unsigned short modeCourse=0;
 char etat_feu=0;
 char num_piste=0;
+char nbTour=0;
 
 
 void envoieFrame(unsigned char id, unsigned short val)
@@ -200,17 +201,8 @@
 
 
 
-/*void clavier(){
-	//while(1){
-		rcv_dtq(QdmTouche,&touche.msg);
-		consigne=touche.data.val;
-		c=consigne;
-		//lcd_putc(c);
-		//}
-}*/
 
 
-
 unsigned short acquiFrame(unsigned char id)
 {
 	unsigned short valAcqui;
@@ -266,6 +258,7 @@
 	}
 	sta_tsk(ID_asserv_r);
 	sta_tsk(ID_asserv_v);
+	sta_tsk(ID_cmptT);
 }
 
 
@@ -278,7 +271,7 @@
 		commandeT=kt*(consigne-pos_obs);
 		envoieFrame('T',commandeT);
 		pos_obs=acquiFrame('R');
-		dly_tsk(10);
+		dly_tsk(15);
 	}
 }
 
@@ -289,6 +282,7 @@
 	char num_capt;
 	char couleur_capt;
 	dist_obs=acquiFrame('U');
+	num_piste=modeCourse;
 	while(1){
 		dist_obs=acquiFrame('U');
 		val_capt=acquiFrame('C');
@@ -300,22 +294,32 @@
 			dist_obs=acquiFrame('U');
 		}
 		
-		dly_tsk(10);
+		dly_tsk(5);
 	}
 		
 }
 
+void comptageTour(){	
+	while(1){
+		if(val_capt==67){
+			while(val_capt!=86) dly_tsk(20);;
+			nbTour++;
+		}
+	}
+	dly_tsk(20);		
+}
+
 void asserv_vitesse()
 {
 	while(1)
 	{
-		if(Bp_G==1)
+		if(Bp_G==1 || nbTour==3)
 		{
 			commandeV=0;
 		}
 		else
 		{
-			dans=intervalle(commandeR,15);
+			dans=intervalle(commandeR,10);
 			switch(val_capt)
 			{
 				case 99:
@@ -329,57 +333,71 @@
 					kr=0;
 					break;
 				case 106:
-					commandeV=2;
+					commandeV=7;
 					kr=0.8;
 					break;
 				case 118:
-					commandeV=35;
-					commandeR=-11;
+					commandeV=50;
+					commandeR=-7;
 					envoieFrame('D',commandeR);
 					kr=0;
 					break;
-				case 114:
+				case 114:					//tronçon psite noire bosse
 					commandeV=10;
-					kr=1.5;
-					while(val_capt!=82 && val_capt!=67)
+					kr=1.2;
+				case 66:
+					if(num_piste==3||num_piste==4)
 					{
-						if(val_capt==86)
+						commandeV=13;
+						kr=0.7;
+					}
+					else{
+						
+						commandeV=30;
+						kr=1.4;
+					}
+					break;
+				case 74:
+					if(num_piste==4)
+					{
+						commandeV=25;
+						kr=1;
+						while(val_capt!=82 && val_capt!=67)
 						{
-						borne=687;
-						kr=0.4;
+							if(val_capt==86)
+							{
+								borne=687;
+								kr=1;
+							}
+						dly_tsk(30);
+						borne=0;
 						}
-					dly_tsk(30);
 					}
-					borne=0;
+					else{
+						
+						commandeV=30;
+						kr=1.4;
+					}
 					break;
-				case 66:
-					commandeV=20;
-					kr=0.8;
-					break;
 				default:
 					if(dans==1)
 					{
-						commandeV=65;
-						kr=0.6;
+						commandeV=60;
+						kr=1;
 					}
 					else
 					{
-						commandeV=35;
-						kr=1.7;
+						commandeV=32;
+						kr=1.4;
 					}
 					break;
 				}		
 			
 		}
-		dly_tsk(30);
+		dly_tsk(5);
 	}
 }
 
-/*int virage()
-{
-	if(commandeR==0 && dist_obs<dist_consigne) return 1;
-	else
-}*/
 
 void acqui()
 {
Index: branch/beaussant/Emb_App/conf_noyau.cfg
===================================================================
--- branch/beaussant/Emb_App/conf_noyau.cfg	(revision 508)
+++ branch/beaussant/Emb_App/conf_noyau.cfg	(revision 509)
@@ -54,22 +54,34 @@
 };
 
 
+
+
 task[]{
 	entry_address	= ctrl_t();
 	name	= ID_ctrlt;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 4;
+	priority	= 6;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
 task[]{
+	entry_address	= comptageTour();
+	name	= ID_cmptT;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 7;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
 	entry_address	= asserv_roue();
 	name	= ID_asserv_r;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 3;
+	priority	= 4;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
@@ -79,7 +91,7 @@
 	name	= ID_asserv_v;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 3;
+	priority	= 5;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
@@ -89,7 +101,7 @@
 	name	= ID_depart;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 5;
+	priority	= 7;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
