Index: branch/colomban/Emb_App.tws
===================================================================
--- branch/colomban/Emb_App.tws	(revision 255)
+++ branch/colomban/Emb_App.tws	(revision 256)
@@ -7,6 +7,7 @@
 [GENERAL_DATA]
 [BREAKPOINTS]
 [OPEN_WORKSPACE_FILES]
+"C:\Users\macolomban1\Downloads\programme_principal_etud (4).c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\clavier.c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\dma0.c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\mli.c" 
@@ -18,6 +19,7 @@
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\Debug\mr308.inc" 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"C:\Users\macolomban1\Downloads\programme_principal_etud (4).c" 150 150 1430 351 0 10 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\Debug\mr308.inc" 0 0 1430 351 0 7 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\conf_noyau.cfg" 0 0 1596 539 0 9 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\crt0mr.a30" 150 150 1430 351 0 6 
Index: branch/colomban/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/colomban/Emb_App/SessionM32C_E8a_system.hsf	(revision 255)
+++ branch/colomban/Emb_App/SessionM32C_E8a_system.hsf	(revision 256)
@@ -141,8 +141,8 @@
 "{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey0" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" 
 "{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" "0000000000000044" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000102" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000143" 
 "{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" 
@@ -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" "0000000000FF0579" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF1DC1" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "00000000000009DC" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000814" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000014" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000044" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000AFA" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000834" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000006" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
 "{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" "0000000000000009" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A08" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "000000000000000C" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000005" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B30" 
 "{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" 
@@ -209,7 +209,9 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "alpha, 2, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Global," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "2" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "cpt, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "3" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -283,10 +285,10 @@
 "{WK_00000001_DISASSEMBLY}" "WINDOW" 0 0 0 "0.00" 0 -4 -30 948 486 9 0 "" "0.0" 
 "{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.11" 365 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0" 
 "{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.48" 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_OUTPUT}" "WINDOW" 59422 0 3 "0.53" 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_system" "WINDOW" 59422 0 4 "0.18" 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 1 "0.23" 365 0 0 350 200 18 0 "32781|32783|<<separator>>|32771|32772|32773|<<separator>>|32786|<<separator>>|32810|32811" "0.0" 
+"{WK_00000001_WATCH}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 1 "0.18" 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" 
 "{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" 
@@ -313,10 +315,11 @@
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\crt0mr.a30" 
+"C:\Users\macolomban1\Downloads\programme_principal_etud (4).c" 
+"E:\tp_info6_2018_colomban\tp_info6\bsp\uart0.c" 
+"E:\tp_info6_2018_colomban\tp_info6\bsp\radiocommande.c" 
+"E:\tp_info6_2018_colomban\tp_info6\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_colomban\tp_info6\Emb_App\Debug\mr308.inc" 
-"E:\tp_info6_2018_colomban\tp_info6\Emb_App\conf_noyau.cfg" 
-"E:\tp_info6_2018_colomban\tp_info6\bsp\radiocommande.c" 
-"E:\tp_info6_2018_colomban\tp_info6\bsp\uart0.c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\periph.c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\clavier.c" 
 "E:\tp_info6_2018_colomban\tp_info6\bsp\dma0.c" 
@@ -367,5 +370,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 95237480 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 85333832 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/colomban/Emb_App/crt0mr.a30
===================================================================
--- branch/colomban/Emb_App/crt0mr.a30	(revision 255)
+++ branch/colomban/Emb_App/crt0mr.a30	(revision 256)
@@ -97,7 +97,7 @@
 ; after reset,this program will start
 ;-----------------------------------------------------------------
 __SYS_INITIAL:
-	LDC	#__Sys_Sp,ISP	; set initial ISP
+LDC	#__Sys_Sp,ISP	; set initial ISP
 
 	MOV.B	#2,0AH
 	MOV.B	#00,PMOD		; Set Processor Mode Register
Index: branch/colomban/Emb_App/programme_principal_etud.c
===================================================================
--- branch/colomban/Emb_App/programme_principal_etud.c	(revision 255)
+++ branch/colomban/Emb_App/programme_principal_etud.c	(revision 256)
@@ -124,7 +124,11 @@
 unsigned short      dist ;
 unsigned short      k=4; //pour augmenter la vitesse jusqu'a la position souhaitée
 unsigned short      ka=1;
+unsigned short 		cpt;
 void vitesse(unsigned short vit);
+CanFrame comm;
+CanFrame req;
+UINT flag;
 
 void main()
 {   
@@ -142,7 +146,9 @@
 	sta_cyc(ID_acqui);
 	sta_tsk(ID_periph_rx);
 	sta_tsk(ID_asserv);
-	sta_tsk(ID_roue);
+	sta_tsk(ID_roue);
+	sta_tsk(ID_capteur);
+	
 	dly_tsk(1500);
 	
     while(1)
@@ -150,9 +156,9 @@
 		LED_J=1;
 		
 		LED_J=0;
+		vitesse(30);
+        
 		
-        vitesse(20);
-		
 	}
 	
 }
@@ -165,9 +171,6 @@
 
 {
 		unsigned short consigne = 400;
-		CanFrame comm;
-	    CanFrame req;
-		UINT flag;
 		while(1){
 			
 			req.data.id = 'R';
@@ -187,7 +190,6 @@
 } 
 
 void vitesse(unsigned short vit){
-		CanFrame comm;
 		comm.data.id = 'V';
 		comm.data.rtr = 0;
 		comm.data.val = vit;
@@ -198,11 +200,8 @@
 
 void asserv_roue(){
 	unsigned short consignes = 770;
-	    CanFrame comm;
-	    CanFrame req;
-		UINT flag;
+	    
 		while(1){
-			
 			req.data.id = 'U';
 			req.data.rtr = 1;
 			periph[ADDR('U')].ev=0X01;
@@ -209,7 +208,14 @@
 			snd_dtq(CanTx, req.msg);
 			wai_flg(ev_periph,0X01,TWF_ANDW, &flag);
 			dist=periph[ADDR('U')].val;
-			
+			if(dist>1600){
+					comm.data.id = 'D';
+					comm.data.rtr = 0;
+					comm.data.val = 0;
+					snd_dtq(CanTx, comm.msg);
+					dly_tsk(150);
+				
+				}
 			comm.data.id = 'D';
 			comm.data.rtr = 0;
 			comm.data.val = ka*(-consignes + dist);
@@ -217,4 +223,17 @@
 			
 		
 		}		
-	}
\ No newline at end of file
+	}
+
+void capteur(){
+	     	while(1)
+			{
+			req.data.id = 'C';
+			req.data.rtr = 1;
+			periph[ADDR('C')].ev=0X01;
+			snd_dtq(CanTx, req.msg);
+			wai_flg(ev_periph,0X01,TWF_ANDW, &flag);
+			cpt=periph[ADDR('C')].val;
+			
+	}
+}
\ No newline at end of file
Index: branch/colomban/Emb_App/conf_noyau.cfg
===================================================================
--- branch/colomban/Emb_App/conf_noyau.cfg	(revision 255)
+++ branch/colomban/Emb_App/conf_noyau.cfg	(revision 256)
@@ -2,7 +2,7 @@
 //
 //    kernel.cfg : building file for MR308 Ver.4.00
 //
-//    Generated by M3T-MR308 GUI Configurator at 2018/12/11 15:58:50
+//    Generated by M3T-MR308 GUI Configurator at 2018/12/14 14:46:45
 //
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -20,7 +20,7 @@
 
 // max definition
 maxdefine{
-	max_task	= 5;
+	max_task	= 6;
 	max_flag	= 3;
 	max_dtq	= 2;
 	max_cyh	= 1;
@@ -79,6 +79,15 @@
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
+task[]{
+	entry_address	= capteur();
+	name	= ID_capteur;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 6;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
 
 flag[]{
 	name	= ev_bus_fin_tr;
Index: branch/colomban/Emb_App/conf_noyau.hcf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
