Index: branch/aseck/sp4a12/main.c
===================================================================
--- branch/aseck/sp4a12/main.c	(revision 862)
+++ branch/aseck/sp4a12/main.c	(revision 863)
@@ -171,7 +171,7 @@
 float d ;
 num_zone=distance_a_la_plus_proche_zone(p,zones,sizeof(zones),&d);
 
-if (num_zone!=2 & fabs(d-44.85)>0.5)
+if (num_zone!=2 && fabs(d-44.85)>0.5)
         {
             printf(("erreur test distance la plus proche "));
             exit(-1);
Index: branch/aseck/sp4c12/SP4c1/SP4c1/SessionM32C_E8a_SYSTEM.hsf
===================================================================
--- branch/aseck/sp4c12/SP4c1/SP4c1/SessionM32C_E8a_SYSTEM.hsf	(revision 862)
+++ branch/aseck/sp4c12/SP4c1/SP4c1/SessionM32C_E8a_SYSTEM.hsf	(revision 863)
@@ -55,7 +55,7 @@
 "{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" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FE0000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FFFFFF" 
 "{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" "000000000000C400" 
@@ -656,7 +656,7 @@
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0Exp98" "0" 
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0Exp99" "0" 
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollHorz" "0" 
-"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollVert" "2" 
+"{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd0ScrollVert" "0" 
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth0" "200" 
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth1" "100" 
 "{F866DB60-6186-11D5-8BBE-0004E2013C71}IOWnd1ColWidth2" "100" 
@@ -675,9 +675,9 @@
 0 
 [WINDOW_POSITION_STATE_DATA_VD1]
 "Help" "TOOLBAR 0" 59419 1 5 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_00000001_CmdLine}" "WINDOW" 59422 0 1 "0.12" 180 1600 -279 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
-"{WK_00000001_IO}SP4c1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 0 "0.50" 180 1600 -279 350 200 18 0 "32817|32826|32819|32820|32821" "0.0" 
-"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 0 "1.00" 180 534 287 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
+"{WK_00000001_CmdLine}" "WINDOW" 59422 0 2 "0.07" 180 1600 -279 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
+"{WK_00000001_IO}SP4c1SessionM32C_E8a_SYSTEM" "WINDOW" 59422 0 1 "0.33" 180 1600 -279 350 200 18 0 "32817|32826|32819|32820|32821" "0.0" 
+"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 0 "0.67" 180 534 287 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0" 
 "{WK_00000002_WORKSPACE}" "WINDOW" 59420 0 0 "1.00" 180 534 287 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" 
@@ -689,19 +689,18 @@
 "{WK_TB00000009_VERSIONCONTROL}" "TOOLBAR 0" 59419 1 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000011_CPU}" "TOOLBAR 0" 59419 2 2 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
 "{WK_TB00000012_MAP}" "TOOLBAR 0" 59419 1 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_TB00000013_SYMBOL}" "TOOLBAR 0" 59419 2 3 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
+"{WK_TB00000013_SYMBOL}" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 18 0 "" "0.0" 
 "{WK_TB00000014_CODE}" "TOOLBAR 0" 59419 2 6 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000016_GRAPHIC}" "TOOLBAR 0" 59419 2 7 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000018_DEFAULTWINDOW}" "TOOLBAR 0" 59419 1 2 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000023_RTOS}" "TOOLBAR 0" 59419 2 8 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 "{WK_TB00000026_MACRO}" "TOOLBAR 0" 59419 1 6 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_TB00000028_RTOSDEBUG}" "TOOLBAR 0" 59419 2 2 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_TB00000029_SYSTEMTOOL}" "TOOLBAR 0" 59419 2 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000028_RTOSDEBUG}" "TOOLBAR 0" 59419 2 3 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
+"{WK_TB00000029_SYSTEMTOOL}" "TOOLBAR 0" 59419 2 5 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
 [WINDOW_POSITION_STATE_DATA_VD2]
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
-"D:\tp_sp4_seck\sp4c12\SP4c1\SP4c1\ncrt0.a30" 
 "D:\tp_sp4_seck\sp4c12\SP4c1\SP4c1\SP4c1.c" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
Index: branch/aseck/sp4c12/SP4c2/SP4c2/SP4c2.c
===================================================================
--- branch/aseck/sp4c12/SP4c2/SP4c2/SP4c2.c	(revision 862)
+++ branch/aseck/sp4c12/SP4c2/SP4c2/SP4c2.c	(revision 863)
@@ -113,43 +113,49 @@
 	
 	while(1)
 	{
-		
-		if (caractere_recu == '$'){
-			nombre_caractere = 0;	
-			etat=reception;
-			checksum_trame=0;
-		}
-		break;
-		
-		if (caractere_recu !='*'){
-			Buffer[nombre_caractere] = caractere_recu;
-			nombre_caractere++;
-			checksum_trame ^= caractere_recu;
-			nombre_caractere_apres_etoile = 0;
-		}
-		else
-        {
+		switch(etat)
+		{
+			case synchronisation :
+			if (caractere_recu == '$'){
+				nombre_caractere = 0;	
+				etat=reception;
+				checksum_trame=0;
+			}
+			break;
+			
+			case reception :
+		    if (caractere_recu !='*'){
+				Buffer[nombre_caractere] = caractere_recu;
+				nombre_caractere++;
+				checksum_trame ^= caractere_recu;
+				nombre_caractere_apres_etoile = 0;
+			}
+			else
+        	{
 			etat =checksum;
+			}
+        	break;
+			
+			case checksum :
+			if (nombre_caractere_apres_etoile==2){
+				etat=validation;
+				checksum_calculer=hex_int(checksum_fin_trame);
+			}
+			nombre_caractere_apres_etoile++;
+			break;
+			
+			case validation :
+				if (checksum_trame==checksum_calculer){
+				etat = synchronisation;
+				return nombre_caractere;
+			}
+			else
+			{
+				etat = synchronisation;
+				return 0;
+			}
+			break;
 		}
-        break;
-		
-		if (nombre_caractere_apres_etoile==2){
-			etat=validation;
-			checksum_calculer=hex_int(checksum_fin_trame);
-		}
-		nombre_caractere_apres_etoile++;
-		break;
-		
-		if (checksum_trame==checksum_calculer){
-			etat = synchronisation;
-			return nombre_caractere;
-		}
-		else
-		{
-			etat = synchronisation;
-			return 0;
-		}
-		break;
 	}
 }
 
@@ -160,19 +166,13 @@
 
 
 
-/**trame1 correct**/
 
-char trame1[]={'$','G','P','G','G','A',',','0','6','4','0','3','6','.','2','8','9',',','4','8','3','6','.','5','3','7','5',',','N',',','0','0','7','4','0','.','9','3','7','3',',','E',',','1',',','0','4',',','3','.','2',',','2','0','0','.','2',',','M',',',',',',',',','0','0','0','0','*','0','E'}; 
-/**trame2 incorrect**/ 
 
-char trame2[]={'$','G','P','G','G','A',',','1','4','1','9','1','4','.','0','0',',','4','5','4','5','.','0','0','0','0',',','N',',','0','0','3','0','6','.','6','0','3','6',',','E',',','1',',','0','5',',','3','.','4',',','4','9','9','.','3',',','M',',',',','M',',',',','*','7','D'};
 
 
-
-int hex_int1(char *c) 
-{ 
+int hex_int1(char *c) { 
 	int i=0;         /**La boucle permet de travaller sur les deux derniers caractères du checksum de la trame reçue**/ 
-	for(i=0; i<2; i++) 
+	for(i=0; i<2; i++)
 	{  
 		/**si le caractere est entre 0 et 9 ->retranche en ascii '0', soit 48 en décimal**/ 
 		if(c[i]>='0' && c[i]<='9') 
@@ -180,7 +180,7 @@
 			c[i] = c[i]-48; 
 		}
 		 /**si le caractere est superieur a 10, soit A en hex ->retranche le nombre 55**/ 
-		 if(c[i]>='A') 
+	 	if(c[i]>='A') 
 		 { 
 			 c[i] = c[i]-55; 
 		 } 
@@ -193,7 +193,7 @@
 
 
 
-int rectrame(char *Buffer, char *trame)
+int irectrame(char *Buffer, char *trame)
 {
 	int nombre_caractere_apres_etoile=0;
 	int k=0;
@@ -237,8 +237,10 @@
 		k++;
 		checksum_fin_trame[nombre_caractere_apres_etoile] = caractere_recu;
 		if(nombre_caractere_apres_etoile == 2)
-		checksum_calculer = hex_int(checksum_fin_trame);
-		nombre_caractere_apres_etoile++;
+		{
+			checksum_calculer = hex_int(checksum_fin_trame);
+			nombre_caractere_apres_etoile++;
+		}
 	}
 	if(checksum_trame == checksum_calculer)
 	return nombre_cararactere;
@@ -251,8 +253,11 @@
 int main(void)
 {
 	char Buffer[80];
+	
+	printf("\nombre de caractere: %d\n", rectrame(Buffer));
 	printf("trame valide :\nnombre de caractere : %d\n", rectrame(Buffer, trame1));
 	printf("trame erronee\nnombre de caractere : %d\n", rectrame(Buffer, trame2));
+	
 	return 0;
 }
 
