Index: branch/lebanitou/Emb_App.tws
===================================================================
--- branch/lebanitou/Emb_App.tws	(revision 466)
+++ branch/lebanitou/Emb_App.tws	(revision 467)
@@ -8,6 +8,7 @@
 [BREAKPOINTS]
 [OPEN_WORKSPACE_FILES]
 "E:\tp_info6_lebanitou\bsp\lcd.c" 
+"E:\tp_info6_lebanitou\bsp\lcd.h" 
 "E:\tp_info6_lebanitou\bsp\uart0.c" 
 "E:\tp_info6_lebanitou\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_lebanitou\Emb_App\crt0mr.a30" 
@@ -17,6 +18,7 @@
 "E:\tp_info6_lebanitou\Emb_App\crt0mr.a30" 75 75 1430 351 0 1 
 "E:\tp_info6_lebanitou\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 0 
 "E:\tp_info6_lebanitou\bsp\lcd.c" 100 100 1430 351 0 4 
+"E:\tp_info6_lebanitou\bsp\lcd.h" 125 125 1430 351 0 5 
 "E:\tp_info6_lebanitou\bsp\uart0.c" 125 125 1430 351 0 3 
 [LOADED_PROJECTS]
 "EmbM32C87App" 
Index: branch/lebanitou/Emb_App/SessionM32C_E8a_system.ini
===================================================================
--- branch/lebanitou/Emb_App/SessionM32C_E8a_system.ini	(revision 466)
+++ branch/lebanitou/Emb_App/SessionM32C_E8a_system.ini	(revision 467)
@@ -25,4 +25,4 @@
 [Target]
 M32C E8a SYSTEM=Renesas Communications
 [USER_DATA]
-RESET=ff0130
+RESET=ff0034
Index: branch/lebanitou/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/lebanitou/Emb_App/SessionM32C_E8a_system.hsf	(revision 466)
+++ branch/lebanitou/Emb_App/SessionM32C_E8a_system.hsf	(revision 467)
@@ -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" "0000000000FF2DBE" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF2CD3" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000001988" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000BDA" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000001BAC" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000BF0" 
 "{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_20" "00000000000000C5" 
 "{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" "00000000000019C0" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000001BD6" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "000000000000198E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000001BB0" 
 "{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" 
@@ -319,6 +319,7 @@
 "E:\tp_info6_lebanitou\bsp\lcd.c" 
 "E:\tp_info6_lebanitou\Emb_App\crt0mr.a30" 
 "E:\tp_info6_lebanitou\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_lebanitou\bsp\lcd.h" 
 "E:\tp_info6_lebanitou\bsp\uart0.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
@@ -366,5 +367,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 90621984 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 89838856 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/lebanitou/Emb_App/programme_principal_etud.c
===================================================================
--- branch/lebanitou/Emb_App/programme_principal_etud.c	(revision 466)
+++ branch/lebanitou/Emb_App/programme_principal_etud.c	(revision 467)
@@ -122,31 +122,22 @@
 
 //variables globales utilisées par les asservissements
 
-int pos_tourelle;             //position de la tourelle
 int vitesse;
-int pos;
-
+int pos=0;
 CanFrame comm;
 int consigne=450;                 // valeur de la consigne
-int k=1; 
-int k_a=1;                         // gain
+int k=1;                          // gain                         
 int angle;
+int alpha; 
+int mur=710;
 int valeur;
-int valeur1;
-short dist,error;
-int pos=0;
-int mur=700;
-int take;
+int capt;
+int numero;
+int mode;
+int feu; 
+short code_touche;
 
 
-//telemetre
-void rotation()
-{
-    CanFrame comm;
-        comm.data.id= 'T';
-        comm.data.rtr= 0;           //indique une ?criture
-        comm.data.val= 120;
-}
 //envoie la voiture 
 void essai() 
 {
@@ -153,8 +144,37 @@
         while(1){
                 comm.data.id= 'V';
                 comm.data.rtr= 0;           //indique une ?criture
-                comm.data.val= 25;
-                snd_dtq(CanTx, comm.msg);
+				
+				//forçage du vehicule à l'arrêt
+				if(Bp_G==1)
+				{
+					 comm.data.val= 0;
+					 snd_dtq(CanTx,comm.msg);
+				}
+                else 
+				{
+					comm.data.val= 25;
+					snd_dtq(CanTx,comm.msg);
+				}
+				
+				
+				//feu tricolore
+				feu=periph[ADDR('M')].val;
+				//feu=feu&0x80;
+				if(feu==0x00000000)
+				{
+				
+				comm.data.val= 0;
+			    snd_dtq(CanTx,comm.msg);	
+				}
+				else 
+				{
+				
+					comm.data.val= 25;
+					snd_dtq(CanTx,comm.msg);
+				}
+				
+                
                 dly_tsk(20);
         }
 }
@@ -163,94 +183,143 @@
 // asservissement tourelle
 void asservis()
 {
+	
         CanFrame requete ;
         CanFrame reponse;
         CanFrame comm;
+	
         while(1){
                 requete.data.id='R';
                 requete.data.rtr=1;                   //Indique une requ?te de lecture
                 snd_dtq(CanTx, requete.msg);
-                
+                dly_tsk(5);
                 angle=periph[ADDR('R')].val;
-				dly_tsk(5);
+				valeur = consigne-angle;
+				
                 comm.data.id= 'T';
-                comm.data.rtr= 0;
-                valeur=k*(consigne-angle);
-                comm.data.val=valeur;
-                snd_dtq(CanTx, comm.msg);
+                comm.data.rtr= 0;	
+				comm.data.val=valeur;
+				snd_dtq(CanTx, comm.msg);
                 dly_tsk(10);
-        }                
+        }   
+ 
+		     
 }
 
-// asservissement direction des roues
-void direction()
+// asservissement direction des roues et distance
+
+void distance()
 {
-        CanFrame requete;
-        CanFrame comm;
+        CanFrame requete_pos;
+        CanFrame reponse;
+		CanFrame comm_alpha;
+		
         
         while(1){
-			 while(mur<=pos){
-			 
-                requete.data.id='D';
-                requete.data.rtr=1;                   //Indique une requ?te de lecture
-                snd_dtq(CanTx, requete.msg);               			
-			    comm.data.id= 'D';
-                comm.data.rtr= 0;
-				take=k*(mur-pos);
-				comm.data.val=-take;
-                snd_dtq(CanTx, comm.msg);
-					dly_tsk(5);
-				}
-                dly_tsk(10);
+			    requete_pos.data.id='U';
+                requete_pos.data.rtr=1;                   //Indique une requ?te de lecture
+				snd_dtq(CanTx, requete_pos.msg);
+				dly_tsk(5);
 				
-                
+               
+                pos=periph[ADDR('U')].val;
 				
-        }                
+				if( pos < 1500 )
+				{
+				
+				if(pos<1100)
+				{
+					alpha=-(700-pos);
+				}
+				else 
+				{
+					comm_alpha.data.val=0;
+				}
+				comm_alpha.data.id= 'D';
+	            comm_alpha.data.rtr= 0;
+				comm_alpha.data.val=alpha;
+				snd_dtq(CanTx,  comm_alpha.msg);
+				}            
+								
+}              
 }
 
 
-void distance() 
+
+void modecourse()
 {
-      
-		CanFrame requete ;
-        
-        while(1){
-                requete.data.id='U';
-                requete.data.rtr=1;                   //Indique une requ?te de lecture
-                snd_dtq(CanTx, requete.msg);
-                  dly_tsk(5);
-                pos=periph[ADDR('U')].val;
-				
-   	
-        }                
-}
+CanFrame requete ;
+UINT flag;
+while(1){
+	       
                 
+                        requete.data.id='C';                // informations sur le dernier capteur touché                                    
+                        requete.data.rtr=1;                //Indique une requ?te de lecture
+                        snd_dtq(CanTx,requete.msg);
 
+                        
+                        capt=periph[ADDR('C')].val;   
+						                             
+                        requete.data.id='M';              //mode de course                                
+                        requete.data.rtr=1;
+					       
+                        snd_dtq(CanTx,requete.msg);
+                        mode=periph[ADDR('M')].val;                              
+                        numero= mode&0x000F;
+	                    dly_tsk(15);
+}
 
 
 
+	
+}
+void clavier()
+{
+	while(1)
+	{
+		vrcv_dtq(QdmTouche,&code_touche);
+	}
+	dly_tsk(30);
+}
 
 
 
 
 
-
-
-
 void acqui()
 {
-  LED_V=!LED_V;	
+  LED_V=!LED_V;        
 }
 
-//affichage de la valeur de la distance sur lcd
+
+
+
+//affichage des pistes sur lcd
 void affichage()
 {
-	while(1){
-	int valeur1;
-    char str[20];
-    sprintf(str,"%d",valeur1);
-    lcd_str(str);
-	}
+	
+	char str[20];
+        while(1){
+       
+       switch(numero)
+	   {
+		   case 1:
+		   lcd_str("vert");
+		   break;
+		   case 2:
+		   lcd_str("bleu");
+		   break;
+		   case 3:
+		   lcd_str("rouge");
+		   break;
+		   case 4:
+		   lcd_str("noir");
+		   break;
+		   
+	    }
+  
+	   	dly_tsk(10);
+        }
 }
 
 
@@ -257,6 +326,8 @@
 
 
 
+
+
 void main()
 {
 	
@@ -269,12 +340,15 @@
 	capture_init();
 	sta_tsk(ID_periph_rx);
 	sta_tsk(ID_asservis);
-	sta_tsk(ID_direction);
 	dly_tsk(2000);
+	
+//	sta_tsk(ID_direction);
 	sta_tsk(ID_essai);
-	//sta_tsk(ID_distance);
-	//sta_cyc(ID_acqui);
+	sta_tsk(ID_distance);
+	sta_cyc(ID_acqui);
 	sta_tsk(ID_affichage);
+	sta_tsk(ID_modecourse);
+	sta_tsk(ID_clavier);
 	
     while(1){
 		
Index: branch/lebanitou/Emb_App/conf_noyau.cfg
===================================================================
--- branch/lebanitou/Emb_App/conf_noyau.cfg	(revision 466)
+++ branch/lebanitou/Emb_App/conf_noyau.cfg	(revision 467)
@@ -20,7 +20,7 @@
 
 // max definition
 maxdefine{
-	max_task	= 3;
+	max_task	= 7;
 	max_flag	= 3;
 	max_dtq	= 2;
 	max_cyh	= 1;
@@ -159,16 +159,36 @@
 	name	= ID_asservis;
 	stack_size	= 512;
 	stack_section	= stack;
-	priority	= 8;
+	priority	= 2;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
+//task[]{
+//	entry_address	= rotation();
+//	name	= ID_rotation;
+//	stack_size	= 512;
+//	stack_section	= stack;
+//	priority	= 8;
+//	initial_start	= OFF;
+//	exinf	= 0x0;
+//};
+
 task[]{
-	entry_address	= rotation();
-	name	= ID_rotation;
+	entry_address	= distance();
+    name= ID_distance;
 	stack_size	= 512;
 	stack_section	= stack;
+	priority	= 2;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+task[]{
+	entry_address	= clavier();
+	name	= ID_clavier;
+	stack_size	= 512;
+	stack_section	= stack;
 	priority	= 8;
 	initial_start	= OFF;
 	exinf	= 0x0;
@@ -175,8 +195,8 @@
 };
 
 task[]{
-	entry_address	= direction();
-  name	= ID_direction;
+	entry_address	= modecourse();
+	name	= ID_modecourse;
 	stack_size	= 512;
 	stack_section	= stack;
 	priority	= 8;
@@ -184,26 +204,6 @@
 	exinf	= 0x0;
 };
 
-//task[]{
-//	entry_address	= distance();
-//	name	= ID_distance;
-//	stack_size	= 512;
-//	stack_section	= stack;
-//	priority	= 8;
-//	initial_start	= OFF;
-//	exinf	= 0x0;
-//};
-
-//task[]{
-//	entry_address	= detection();
-//	name	= ID_detection;
-//	stack_size	= 512;
-//	stack_section	= stack;
-//	priority	= 8;
-//	initial_start	= OFF;
-//	exinf	= 0x0;
-//};
-
 task[]{
 	entry_address	= affichage();
 	name	= ID_affichage;
Index: branch/lebanitou/Emb_App/EmbM32C87App.tps
===================================================================
--- branch/lebanitou/Emb_App/EmbM32C87App.tps	(revision 466)
+++ branch/lebanitou/Emb_App/EmbM32C87App.tps	(revision 467)
@@ -18,7 +18,7 @@
 "SessionM32C_E8a_system" 
 [GENERAL_DATA_PROJECT]
 [GENERAL_DATA_CONFIGURATION_Debug]
-"PROJECT_FILES_MODIFIED_DATA_TAG" "FALSE" 
+"PROJECT_FILES_MODIFIED_DATA_TAG" "TRUE" 
 [SESSIONS_Debug]
 "DefaultSession" 
 "SessionM32C_E8a_system" 
