Index: branch/schiano/Emb_App.tws
===================================================================
--- branch/schiano/Emb_App.tws	(revision 43)
+++ branch/schiano/Emb_App.tws	(revision 44)
@@ -7,8 +7,16 @@
 [GENERAL_DATA]
 [BREAKPOINTS]
 [OPEN_WORKSPACE_FILES]
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\sys_rom.inc" 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" 
 [WORKSPACE_FILE_STATES]
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 50 50 1430 351 0 3 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\sys_rom.inc" 0 0 1430 351 0 4 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 25 25 1430 351 0 1 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 50 50 1430 351 0 2 
 "E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 539 1 0 
 [LOADED_PROJECTS]
 "EmbM32C87App" 
Index: branch/schiano/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/schiano/Emb_App/SessionM32C_E8a_system.hsf	(revision 43)
+++ branch/schiano/Emb_App/SessionM32C_E8a_system.hsf	(revision 44)
@@ -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" "0000000000004044" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000001" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
 "{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" "0000000000FF056E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF311B" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000928" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000074A" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000A20" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000824" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004004" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C0" 
 "{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" "0000000000000008" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000946" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000004" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "00000000001200FF" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A20" 
 "{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" 
@@ -205,9 +205,15 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "200" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH" "c,buff,n,rx,flag," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "dma0_fin_tr, 2, 0, P, Col, Hex, MN" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "0" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "reponse.data.val, 10, 0, P, Col, Hex, N" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "alpha, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "teta, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "distancemur, 2, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "4" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -277,14 +283,14 @@
 0 
 [WINDOW_POSITION_STATE_DATA_VD1]
 "Help" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
-"{WK_00000001_CmdLine}" "WINDOW" 59422 0 0 "0.14" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
+"{WK_00000001_CmdLine}" "WINDOW" 59422 0 2 "0.09" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
 "{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.16" 365 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "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 1 "1.00" 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 3 "0.15" 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_OUTPUT}" "WINDOW" 59422 0 3 "0.55" 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.16" 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 4 "0.13" 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" 
@@ -309,7 +315,11 @@
 [WINDOW_POSITION_STATE_DATA_VD3]
 [WINDOW_POSITION_STATE_DATA_VD4]
 [WINDOW_Z_ORDER]
-"E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6\Emb_App\programme_principal_etud.c" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\programme_principal_etud.c" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\conf_noyau.cfg" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\sys_rom.inc" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\crt0mr.a30" 
+"E:\tp_info6_2018_schiano\tp_info6\Emb_App\Debug\mr308.inc" 
 [TARGET_NAME]
 "M32C E8a SYSTEM" "" 0 
 [STATUSBAR_STATEINFO_VD1]
@@ -356,5 +366,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 0 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 94254904 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/schiano/Emb_App/programme_principal_etud.c
===================================================================
--- branch/schiano/Emb_App/programme_principal_etud.c	(revision 43)
+++ branch/schiano/Emb_App/programme_principal_etud.c	(revision 44)
@@ -26,7 +26,7 @@
 #include "carte_io.h"
 #include "carte_m32.h"
 #include <math.h>
-void asserv0(void);
+//void asserv0(void);
 // Potentiometre: lire les registres ad00 et ad01, les valeurs sont sur 10 bits.
 
 // Clavier: vrcv_dtq(QdmTouche,&code_touche) pour lire la derniere touche appuyee sur le clavier.
@@ -122,7 +122,11 @@
 
 unsigned int alpha =0;
 unsigned int teta =100;
-
+unsigned int consignealpha = 450;
+unsigned int angleRoue =0;
+//unsigned int distancemur =0;
+//unsigned int consignedistance = 724;
+int k=10;
 
 void main()
 {
@@ -137,8 +141,12 @@
 
 	sta_cyc(ID_acqui);
 //	sta_tsk(ID_periph_rx);
-
-
+	sta_cyc(ID_asserv1);
+	sta_tsk(ID_asserv0);
+	
+	//sta_cyc(ID_asservangleroue);
+	//sta_tsk(ID_asservRoue);
+	
     while(1)
     {
 		//LED_J=1;
@@ -145,7 +153,7 @@
 		//dly_tsk(100);
 		//LED_J=0;
 		//dly_tsk(100);
-		asserv0();
+		//asserv0();
     }
 }
 
@@ -155,33 +163,65 @@
 }
 
 void asserv0()
-{
+{	
 	CanFrame comm;
-	//CanFrame go;
+	CanFrame go;
 	CanFrame demande;
 	CanFrame reponse;
-	int k=1;
+	
+	while(1){
 
-	comm.data.id='T';
-	comm.data.rtr=0;
-	comm.data.val=teta; //consigne de vitesse de rotation de la tourelle
+		comm.data.id='T';
+		comm.data.rtr=0;
+		comm.data.val=teta; //consigne de vitesse de rotation de la tourelle
 	
-	snd_dtq (CanTx,comm.msg);
+		snd_dtq (CanTx,comm.msg);
 	
-	/*go.data.id='V';
-	go.data.rtr=0;
-	go.data.val=100; //consigne de vitesse de rotation de la voiture
+		go.data.id='V';
+		go.data.rtr=0;
+		go.data.val=10; //consigne de vitesse de la voiture
 	
-	snd_dtq (CanTx,go.msg);*/
+		snd_dtq (CanTx,go.msg);
 	
-	demande.data.id='R';
-	demande.data.rtr=1;
+		demande.data.id='R';
+		demande.data.rtr=1;
 	
-	snd_dtq (CanTx,demande.msg); // Interrogation du peripherique
-	rcv_dtq (CanRx,&reponse.msg); // Attente de la reponse
+		snd_dtq (CanTx,demande.msg); // Interrogation du peripherique
+		rcv_dtq (CanRx,&reponse.msg); // Attente de la reponse
 
- 	alpha = reponse.data.val;
+ 		alpha = reponse.data.val;
 	
-	//if (alpha==450)teta = (alpha -450);
-	if (alpha!=450)teta = k*(450 - alpha);
-}
\ No newline at end of file
+	}
+}
+
+void asserv1(){
+	if (alpha!=consignealpha)teta = k*(consignealpha - alpha);
+}
+	
+/*void asservRoue(){
+	
+	CanFrame angle;
+	CanFrame demandeU;
+	CanFrame reponseU;
+	
+	while(1){
+	
+		angle.data.id='D';
+		angle.data.rtr=0;
+		angle.data.val=angleRoue; //consigne d'angle des roues de la voiture
+	
+		snd_dtq (CanTx,angle.msg);
+	
+		demandeU.data.id='U';
+		demandeU.data.rtr=1;
+	
+		snd_dtq (CanTx,demandeU.msg); //Interrogation du peripherique
+		rcv_dtq (CanRx,&reponseU.msg); //Attente de la reponse
+
+ 		distancemur = reponseU.data.val;
+	}
+}*/
+ 
+/*void asservangleroue(){
+	if (distancemur!=consignedistance)angleRoue = (consignedistance - distancemur);
+}*/
\ No newline at end of file
Index: branch/schiano/Emb_App/conf_noyau.cfg
===================================================================
--- branch/schiano/Emb_App/conf_noyau.cfg	(revision 43)
+++ branch/schiano/Emb_App/conf_noyau.cfg	(revision 44)
@@ -62,7 +62,27 @@
 	exinf	= 0x0;
 };
 
+task[]{
+	entry_address	= asservRoue();
+	name	= ID_asservRoue;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 5;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
 
+task[]{
+	entry_address	= asserv0();
+	name	= ID_asserv0;
+	stack_size	= 256;
+	stack_section	= stack;
+	priority	= 4;
+	initial_start	= OFF;
+	exinf	= 0x0;
+};
+
+
 flag[]{
 	name	= ev_bus_fin_tr;
 	initial_pattern	= 0x0000;
@@ -110,7 +130,27 @@
 	phs_counter	= 0x0;
 };
 
+cyclic_hand[]{
+	entry_address	= asserv1();
+	name	= ID_asserv1;
+	exinf	= 0x0;
+	start	= OFF;
+	phsatr	= OFF;
+	interval_counter	= 100;
+	phs_counter	= 0x0;
+};
 
+cyclic_hand[]{
+	entry_address	= asservangleroue();
+	name	= ID_asservangleroue;
+	exinf	= 0x0;
+	start	= OFF;
+	phsatr	= OFF;
+	interval_counter	= 150;
+	phs_counter	= 0x0;
+};
+
+
 vdataqueue[]{
 	name	= QdmTouche;
 	wait_queue	= TA_TFIFO;
