Revision 257

View differences:

branch/belin/Emb_App.tws
18 18
"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 
19 19
"E:\tp_info_2018_belin\Emb_App\Debug\kernel_id.h" 
20 20
"E:\tp_info_2018_belin\Emb_App\Debug\kernel_sysint.h" 
21
"E:\tp_info_2018_belin\Emb_App\Debug\mr308.inc" 
21 22
"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 
22 23
[WORKSPACE_FILE_STATES]
23 24
"E:\tp_info_2018_belin\Emb_App\Debug\kernel_id.h" 50 50 790 335 0 1 
24 25
"E:\tp_info_2018_belin\Emb_App\Debug\kernel_sysint.h" 75 75 790 335 0 2 
26
"E:\tp_info_2018_belin\Emb_App\Debug\mr308.inc" 100 100 765 416 0 12 
25 27
"E:\tp_info_2018_belin\Emb_App\conf_noyau.cfg" 50 50 765 416 0 10 
26
"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 100 100 790 335 0 3 
27
"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" -8 -30 956 629 1 0 
28
"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" -8 -30 956 629 1 3 
29
"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 0 0 956 629 0 0 
28 30
"E:\tp_info_2018_belin\bsp\can.c" 100 100 765 416 0 4 
29 31
"E:\tp_info_2018_belin\bsp\clavier.c" 125 125 765 416 0 5 
30 32
"E:\tp_info_2018_belin\bsp\dma0.c" 150 150 765 416 0 6 
branch/belin/Emb_App/SessionM32C_E8a_system.ini
25 25
[Target]
26 26
M32C E8a SYSTEM=Renesas Communications
27 27
[USER_DATA]
28
RESET=ff0014
28
RESET=ff001a
branch/belin/Emb_App/SessionM32C_E8a_system.hsf
141 141
"{55384715-F881-421C-A548-D7D1ABE158E1}PDMRWndInstanceKey0" "{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" 
142 142
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_DENORMAL_MODE" "0" 
143 143
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_EVAL_ROUND_MODE" "0" 
144
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000004044" 
144
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000000000" 
145 145
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000020" 
146 146
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_10" "0000000000000000" 
147 147
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_11" "0000000000000000" 
......
149 149
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
150 150
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
151 151
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000512" 
152
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF057E" 
152
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF17D2" 
153 153
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
154
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000AEC" 
155
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000824" 
154
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000CF6" 
155
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000808" 
156 156
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
157
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
157
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004005" 
158 158
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
159 159
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_22" "0000000000000000" 
160 160
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_23" "0000000000000000" 
......
164 164
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_27" "0000000000000000" 
165 165
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_28" "0000000000000000" 
166 166
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_29" "0000000000000000" 
167
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000000000" 
167
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_3" "0000000000003000" 
168 168
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_30" "0000000000000000" 
169 169
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_31" "0000000000000000" 
170 170
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_32" "0000000000000000" 
171 171
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000" 
172 172
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "000000000000036A" 
173 173
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
174
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000008" 
174
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000001" 
175 175
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
176
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000B20" 
176
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000D22" 
177 177
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
178 178
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
179 179
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
......
205 205
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth2" "120" 
206 206
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ColWidth3" "200" 
207 207
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH" "c,buff,n,rx,flag," 
208
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "Distance, 2, 0, P, Col, Dec, MA" 
209
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Global," 
208
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "capt, 2, 0, P, Col, Hex, MA" 
209
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
210 210
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "correction, 10, 0, P, Col, Hex, N" 
211 211
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
212
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "2" 
212
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "1" 
213 213
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
214 214
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
215 215
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
......
849 849
[WINDOW_POSITION_STATE_DATA_VD3]
850 850
[WINDOW_POSITION_STATE_DATA_VD4]
851 851
[WINDOW_Z_ORDER]
852
"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 
852 853
"E:\tp_info_2018_belin\Emb_App\programme_principal_etud.c" 
853
"E:\tp_info_2018_belin\Emb_App\crt0mr.a30" 
854
"E:\tp_info_2018_belin\Emb_App\Debug\mr308.inc" 
855
"E:\tp_info_2018_belin\Emb_App\conf_noyau.cfg" 
854 856
"E:\tp_info_2018_belin\bsp\periph.c" 
855
"E:\tp_info_2018_belin\Emb_App\conf_noyau.cfg" 
856 857
"E:\tp_info_2018_belin\Emb_App\Debug\kernel_id.h" 
857 858
"E:\tp_info_2018_belin\bsp\uart0.c" 
858 859
"E:\tp_info_2018_belin\bsp\dma0.c" 
......
907 908
[FLASH_DETAILS]
908 909
"" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
909 910
[BREAKPOINTS]
910
"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 101788032 1 "{00000000-0000-0000-C000-000000000046}" "" 
911
"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 101067480 1 "{00000000-0000-0000-C000-000000000046}" "" 
911 912
[END]
branch/belin/Emb_App/programme_principal_etud.c
120 120
//'I'/73/Ox49 : D?finition du nom du v?hicule. Doit d?buter par le caract?re '#' et entraine le chargement de la configuration de piste
121 121
//				correspondant au nom du v?hicule si le nom se termine par '*'
122 122

  
123

  
124
unsigned short Distance;
125 123
unsigned short pos_tourelle;
124
unsigned short capt=0;
125
unsigned short GEL=0;
126 126

  
127

  
128 127
	
129 128

  
130 129
void asservissementTourelle(){
......
148 147
	retour=periph[ADDR('R')].val; 
149 148
	
150 149
	//Asservissement
151
	correction=5*(consigne-retour);
150
	correction=4*(consigne-retour);
152 151
	comm.data.id='T';
153 152
	comm.data.rtr = 0;
154 153
	comm.data.val = correction;
155 154
	
156 155
	snd_dtq(CanTx,comm.msg);
157
	dly_tsk(100);
156
	dly_tsk(10);
158 157
	}
159 158

  
160 159
}
......
168 167
	snd_dtq(CanTx,commMoteur.msg);
169 168
}
170 169

  
171
void CalculDistance(){
170
void position(){
172 171
	CanFrame req;
173 172
	UINT flag;
174

  
173
	CanFrame comm;
174
	unsigned short correction,Distance,consigne;
175
	consigne=700;
176
	
175 177
	while(1){
176

  
178
			req.data.id = 'U';
179
			req.data.rtr = 1;
180
			snd_dtq(CanTx, req.msg);
181
			Distance=periph[ADDR('U')].val; 
182
		if(Distance>1500 || GEL==1){
183
				comm.data.id='D';
184
				comm.data.rtr = 0;
185
				comm.data.val = 0;
186
				dly_tsk(10);
187
		}
188
		else{
189
				//Lecture de distance	
190
				req.data.id = 'U';
191
				req.data.rtr = 1;
192
				snd_dtq(CanTx, req.msg);
193
				Distance=periph[ADDR('U')].val; 
194
				//Asservissement
195
				correction=1*(Distance-consigne);
196
				comm.data.id='D';
197
				comm.data.rtr = 0;
198
				comm.data.val = correction;
177 199
	
178
	req.data.id = 'U';
179
	req.data.rtr = 1;
180
	periph[ADDR('R')].ev=0x01;
181
	snd_dtq(CanTx, req.msg);
182
	wai_flg(ev_periph,0x01,TWF_ANDW, &flag);
183

  
184
	Distance=periph[ADDR('U')].val; 
185
	dly_tsk(100);
186
	}
200
				snd_dtq(CanTx,comm.msg);
201
				dly_tsk(10);
202
		}
203
			dly_tsk(10);
204
	}	
187 205
}
188 206

  
189
void position(){
190
	unsigned short correction;
207
void capteur(){
208
	CanFrame req;
209
	UINT flag;
191 210
	CanFrame comm;
192
	while(1){
193
	correction=1*(720-Distance);
194
	comm.data.id='D';
195
	comm.data.rtr = 0;
196
	comm.data.val = correction;
197
	snd_dtq(CanTx,comm.msg);
198
	dly_tsk(100);
199
	LED_R=1;
211
	while (1){
212
			req.data.id = 'C';
213
			req.data.rtr = 1;
214
			snd_dtq(CanTx, req.msg);
215
			capt=periph[ADDR('C')].val;
216
			GEL=0;
217
		while(capt==0x7610){
218
			GEL=1;
219
			req.data.id = 'C';
220
			req.data.rtr = 1;
221
			snd_dtq(CanTx, req.msg);
222
			capt=periph[ADDR('C')].val;
223
			commMoteur(45);
224
			comm.data.id='D';
225
			comm.data.rtr = 0;
226
			comm.data.val = 0;
227
			snd_dtq(CanTx,comm.msg);
228
			dly_tsk(100);
229
		}
230
	 dly_tsk(10);
200 231
	}
201 232
}
202 233
		
203
	
234
		
235
			
204 236
void main()
205 237
{
206 238
	ports_mcu();
207 239
    lcd_init();
208 240
	periph_init();
209
	periph_nom("Matthias");
241
	periph_nom("#BelinMob*");
210 242
	can_init();
211 243
    clavier_init(1);
212 244
	capture_init();
......
214 246

  
215 247

  
216 248
	sta_tsk(ID_periph_rx);
217
	commMoteur(5);
218 249
	sta_tsk(ID_tourelle);
219
	sta_tsk(ID_CalculDistance);
220 250
	sta_tsk(ID_position);
221

  
251
	sta_tsk(ID_capteur);
252
	dly_tsk(1500);
253
	commMoteur(30);
222 254
	
223 255
    while(1)
224 256
    {
branch/belin/Emb_App/conf_noyau.cfg
2 2
//
3 3
//    kernel.cfg : building file for MR308 Ver.4.00
4 4
//
5
//    Generated by M3T-MR308 GUI Configurator at 2018/12/11 16:36:34
5
//    Generated by M3T-MR308 GUI Configurator at 2018/12/14 15:56:26
6 6
//
7 7
////////////////////////////////////////////////////////////////////////////////
8 8

  
......
71 71
	exinf	= 0x0;
72 72
};
73 73
task[]{
74
	entry_address	= CalculDistance();
75
	name	= ID_CalculDistance;
74
	entry_address	= position();
75
	name	= ID_position;
76 76
	stack_size	= 256;
77 77
	stack_section	= stack;
78
	priority	= 5;
78
	priority	= 6;
79 79
	initial_start	= OFF;
80 80
	exinf	= 0x0;
81 81
};
82 82
task[]{
83
	entry_address	= position();
84
	name	= ID_position;
83
	entry_address	= capteur();
84
	name	= ID_capteur;
85 85
	stack_size	= 256;
86 86
	stack_section	= stack;
87
	priority	= 6;
87
	priority	= 5;
88 88
	initial_start	= OFF;
89 89
	exinf	= 0x0;
90 90
};

Also available in: Unified diff