Index: branch/tronel_florian/Emb_App/programme_principal_etud.c
===================================================================
--- branch/tronel_florian/Emb_App/programme_principal_etud.c	(revision 407)
+++ branch/tronel_florian/Emb_App/programme_principal_etud.c	(revision 408)
@@ -118,7 +118,6 @@
 unsigned char t1, t2;
 unsigned char *s=&t1, *cs=&t2;
 
-
 unsigned short cap=0;
 unsigned char cap_H, cap_L;	
 int nb_tour=0;
@@ -133,7 +132,8 @@
 int c=0;
 
 void main()
-{       ports_mcu();
+{       //INITIALISATION
+		ports_mcu();
     	lcd_init();
         periph_init();
         periph_nom("#Flo*");
@@ -143,7 +143,7 @@
 		
 		sta_tsk(ID_periph_rx);
 		
-		
+		//Depart au feu vert
 		sta_tsk(ID_task_5);//en attente du feu
 		
 		while(f!=1);
@@ -155,7 +155,8 @@
 		V=1;
 		copV=1;
 		
-		if(p>2){sta_tsk(ID_task_7);}//capteur
+		sta_tsk(ID_task_8);//capteur
+		sta_tsk(ID_task_7);//gestion
 		sta_tsk(ID_task_1);//vitesse
 		sta_tsk(ID_task_2);//tourelle
 		sta_tsk(ID_task_3);//dist
@@ -166,7 +167,7 @@
 		
 		
 		sta_cyc(ID_HC_1);
-		//sta_cyc(ID_HC_2);
+		sta_cyc(ID_HC_2);
 		sta_cyc(ID_HC_3);
 				  
 }
@@ -180,7 +181,9 @@
 		case 0: v=0; break;
 		case 1: v=35; break;
 		case 2: v=45; break;
-		case 3: v=15; break;
+		case 3: v=5; break;
+		case 4: v=10; break;
+		case 5: v=15; break;
 				
 		}
 		
@@ -214,7 +217,7 @@
 		cons_tourelle.data.val=vit_t;
 		
 		snd_dtq(CanTx,cons_tourelle.msg);
-		dly_tsk(4);	
+		dly_tsk(5);	
 	}
 } 	
 
@@ -236,7 +239,7 @@
 	c++;
 	if(c>400){LED_J=0; c=0;}
 	
-	dly_tsk(3);		
+	dly_tsk(4);		
 	}	
 }
  
@@ -253,7 +256,7 @@
 	cons_roue.data.val=ang_r;
 	
 	snd_dtq(CanTx,cons_roue.msg);
-	dly_tsk(3);		
+	dly_tsk(4);		
 	}	
 }
 
@@ -267,9 +270,9 @@
 	snd_dtq(CanTx,req_d.msg);	
 	
 	 r = periph[ADDR('M')].val;
-	 p = (r & 0x00FF);
-	 f = (r & 0x8000)>>15;
-	 dly_tsk(5);		
+	 p = (r & 0x00FF);//numéro de piste
+	 f = (r & 0x8000)>>15;//couleur du feu
+	 dly_tsk(6);		
 	}
 }
 
@@ -288,26 +291,12 @@
 	lcd_com(0x80);
 	lcd_str(s);
 	
-	dly_tsk(10);	
+	dly_tsk(11);	
 	}
 }
 
 void task_7(){
-CanFrame req_cap;
-unsigned short cap_old=0;
-
 	while(1){
-	req_cap.data.id='C';
-	req_cap.data.rtr=1;
-	snd_dtq(CanTx,req_cap.msg);
-	
-	cap = periph[ADDR('C')].val;
-	if(cap != cap_old){
-	cap_H=(cap & (0xFF00))>>8;
-	cap_L=cap & (0x00FF);
-	cap_old=cap;
-	}
-	
 	switch(cap_H){
 		case 'V': if(cap_L==0x01){
 						nb_tour++;
@@ -321,38 +310,61 @@
 							ter_tsk(ID_task_3);
 							ter_tsk(ID_task_4);
 							stp_cyc(ID_HC_1);
-							stp_cyc(ID_HC_3);}
+							stp_cyc(ID_HC_3);
+							stp_cyc(ID_HC_2);
+							}
 					}
 				
-				if(cap_L==0x03){	
+				if(p>2){	
+					if(cap_L==0x03){	
 				
 				V=2;
 				copV=2;
 				
-				dly_tsk(800);
+				dly_tsk(2300);
+				
+				sus_tsk(ID_task_3);
+				
+				dist=700;
+				dly_tsk(500);
+				
 				V=0;
 				copV=0;
-				sus_tsk(ID_task_3);
 				
-				dist=700;
+				dly_tsk(800);
+				
+				V=3;
+				copV=3;
+				
+				rsm_tsk(ID_task_3);
+				
+				dly_tsk(300);
+						
+				V=4;
+				copV=4;
+				
 				dly_tsk(400);
-				//dly_tsk(200);
-				//V=3;
-				//copV=3;
+						
+				V=5;
+				copV=5;
+				
+				dly_tsk(800);
+						
+				V=1;
+				copV=1;
+						}
 				}
 				
 				break;
 						
-		case 'B': if(cap_L==0x03){
-				 rsm_tsk(ID_task_3);				 
-				 V=3;
-				 copV=3;
-				 
-				 dly_tsk(200);
+		/*case 'B': 
+				if(p>2){
+					if(cap_L==0x03){
+				 			 
 				 V=1;
 				 copV=1;}
-			
-				break;
+					}
+				break;*/
 		
 	}
 	dly_tsk(10);
@@ -359,6 +371,26 @@
 	}
 }
 
+void task_8(){
+CanFrame req_cap;
+unsigned short cap_old=0;
+
+	while(1){
+	req_cap.data.id='C';
+	req_cap.data.rtr=1;
+	snd_dtq(CanTx,req_cap.msg);
+	
+	cap = periph[ADDR('C')].val;
+	if(cap != cap_old){
+	cap_H=(cap & (0xFF00))>>8;
+	cap_L=cap & (0x00FF);
+	cap_old=cap;
+	}
+	dly_tsk(8);
+   }
+}
+
+
 void HC_1(){
 LED_V =~ LED_V;	
 }
Index: branch/tronel_florian/Emb_App/conf_noyau.cfg
===================================================================
--- branch/tronel_florian/Emb_App/conf_noyau.cfg	(revision 407)
+++ branch/tronel_florian/Emb_App/conf_noyau.cfg	(revision 408)
@@ -121,7 +121,7 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
-//acquisition des messages
+//gestion des messages
 task[]{
 	entry_address	= task_7();
 	name	= ID_task_7;
@@ -131,8 +131,17 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+//acquisition des messages
+task[]{
+	entry_address	= task_8();
+	name	= ID_task_8;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 2;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
 
-
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
