Revision 304

View differences:

branch/maincent/tp_info6/Emb_App.tws
14 14
"E:\info6_maincent\tp_info6\Emb_App\programme_principal_etud.c" 
15 15
[WORKSPACE_FILE_STATES]
16 16
"E:\info6_maincent\tp_info6\Emb_App\conf_noyau.cfg" 75 75 1428 347 0 3 
17
"E:\info6_maincent\tp_info6\Emb_App\crt0mr.a30" 0 0 956 523 0 1 
18
"E:\info6_maincent\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 956 523 1 0 
17
"E:\info6_maincent\tp_info6\Emb_App\crt0mr.a30" -8 -30 1596 539 1 1 
18
"E:\info6_maincent\tp_info6\Emb_App\programme_principal_etud.c" 0 0 956 523 0 0 
19 19
"E:\info6_maincent\tp_info6\bsp\radiocommande.c" 50 50 1430 351 0 2 
20 20
"E:\info6_maincent\tp_info6\bsp\uart0.c" 100 100 1356 347 0 4 
21 21
[LOADED_PROJECTS]
branch/maincent/tp_info6/Emb_App/SessionM32C_E8a_system.ini
25 25
[Target]
26 26
M32C E8a SYSTEM=Renesas Communications
27 27
[USER_DATA]
28
RESET=ff0016
28
RESET=ff001e
branch/maincent/tp_info6/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" "0000000000000000" 
145
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_1" "0000000000000000" 
144
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_0" "0000000000004044" 
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" 
148 148
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_12" "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
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000000" 
152
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF0016" 
153
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000000000" 
154
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000000" 
155
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000700" 
156
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000000" 
157
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000000000" 
151
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000512" 
152
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF058A" 
153
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
154
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000001730" 
155
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "000000000000086A" 
156
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "0000000000000001" 
157
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "0000000000004044" 
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" 
......
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
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "0000000000000000" 
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" "0000000000000000" 
174
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000008" 
175 175
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000000" 
176
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000000" 
177
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000000" 
176
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000001766" 
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" 
180 180
"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_COUNT" "36" 
......
207 207
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH" "c,buff,n,rx,flag," 
208 208
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000" "alpha, 1, 0, P, Col, Dec, MA" 
209 209
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
210
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance, 1, 0, P, Col, Dec, MA" 
210
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "distance, 2, 0, P, Col, Dec, MA" 
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_ITEM0002" "piste1, 1, 0, P, Col, Hex, MA" 
213
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
214
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "selecpiste, 1, 0, P, Col, Hex, MA" 
215
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Current Scope," 
216
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "capteur, 1, 0, P, Col, Hex, MA" 
217
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
218
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "5" 
213 219
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
214 220
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
215 221
"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
......
279 285
0 
280 286
[WINDOW_POSITION_STATE_DATA_VD1]
281 287
"Help" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 17 0 "" "0.0" 
282
"{WK_00000001_CmdLine}" "WINDOW" 59422 0 3 "0.08" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
288
"{WK_00000001_CmdLine}" "WINDOW" 59422 0 3 "0.07" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0" 
283 289
"{WK_00000001_DISASSEMBLY}" "WINDOW" 0 0 0 "0.00" 0 -4 -30 948 486 9 0 "" "0.0" 
284 290
"{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 1 "0.08" 365 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0" 
285 291
"{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" 
......
313 319
[WINDOW_Z_ORDER]
314 320
"E:\info6_maincent\tp_info6\Emb_App\crt0mr.a30" 
315 321
"E:\info6_maincent\tp_info6\Emb_App\programme_principal_etud.c" 
322
"E:\info6_maincent\tp_info6\Emb_App\conf_noyau.cfg" 
323
"E:\info6_maincent\tp_info6\bsp\uart0.c" 
316 324
"E:\info6_maincent\tp_info6\bsp\radiocommande.c" 
317
"E:\info6_maincent\tp_info6\bsp\uart0.c" 
318
"E:\info6_maincent\tp_info6\Emb_App\conf_noyau.cfg" 
319 325
[TARGET_NAME]
320 326
"M32C E8a SYSTEM" "" 0 
321 327
[STATUSBAR_STATEINFO_VD1]
......
362 368
[FLASH_DETAILS]
363 369
"" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
364 370
[BREAKPOINTS]
365
"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 91760712 1 "{00000000-0000-0000-C000-000000000046}" "" 
371
"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100870216 1 "{00000000-0000-0000-C000-000000000046}" "" 
366 372
[END]
branch/maincent/tp_info6/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
short piste1;
124
short selecpiste;
125
short modecourse;
126
void piste(){					//detecte la couleur de la piste
127
	while(1)
128
	{
129
		//lecture de la piste
130
        CanFrame reque;
131
        UINT flag;
132
		reque.data.id='M';			//lecture des evenements
133
		reque.data.rtr=1;			//indique une lecture
134
		periph[ADDR('M')].ev=0x04;
135
		snd_dtq(CanTx, reque.msg);
136
		
137
		//Attente de la reponse
138
        wai_flg (ev_periph, 0x04, TWF_ANDW, &flag);
139
        piste1=periph[ADDR('M')].val;
140
		selecpiste = piste1 & 0x00FF;
141
		modecourse = piste1 & 0xFF00;
142
		dly_tsk(25);			
143
	}
144
}
145

  
123 146
short alpha;
124
void tourelle(){
147
void tourelle(){				// vrai pour toutes les pistes
125 148
	while(1)
126 149
	{
127 150
        short k=1; //Gain du correcteur P
......
149 172

  
150 173

  
151 174
short capteur;
152
void zone(){
175
void zone(){				// vrai pour toutes les pistes
153 176
	while(1)
154 177
	{
155 178
		//lecture de la zone
......
163 186
		//Attente de la reponse
164 187
        wai_flg (ev_periph, 0x03, TWF_ANDW, &flag);
165 188
        capteur=periph[ADDR('C')].val;
166
		dly_tsk(15);				
189
		dly_tsk(25);				
167 190
	}
168 191
}
169 192

  
170 193

  
171
short distance;
172
short distance1;
173
void dist(){
194
unsigned short distance;
195
unsigned short distance1;
196
void dist(){				// vrai pour toutes les pistes
174 197
	while(1)
175 198
	{
176 199
        //lecture de la distance du mur
......
200 223
        //Commande de l'angle de roue
201 224
        comm.data.id='D';	//commande angle roue
202 225
        comm.data.rtr=0;	//indique une ecriture
203
        if (distance > 2000 || capteur == 0x5603)
226
		
227
		if (selecpiste == 0x0001 || selecpiste == 0x0002)		// piste verte et bleu
228
		{	
229
        	if (distance > 2000) 
230
			{
231
				// si trou dans la barriere ou zonesaut
232
			}	
233
			else
234
			{
235
				distance1=distance;	 //cas normal: si on est au milieu de la piste angle des roues ? 0
236
        	}
237
  			comm.data.val=s*(distance1-706);
238
			snd_dtq(CanTx, comm.msg);
239
			dly_tsk(20);
240
		}
241
		
242
		else if (selecpiste == 0x0003) 		// piste rouge
204 243
		{
205
			// si trou dans la barriere ou zonesaut
244
			if (distance > 2000 )  
245
			{
246
				// si trou dans la barriere ou zonesaut
247
			}
248
			else if (capteur == 0x6aff) //bosse piste rouge 
249
			{
250
				
251
			}
252
			else
253
			{
254
				distance1=distance;	 //cas normal: si on est au milieu de la piste angle des roues ? 0
255
        	}
256
  			comm.data.val=s*(distance1-706);
257
			snd_dtq(CanTx, comm.msg);
258
			 dly_tsk(20);
259
		}
260
		
261
		else 		// piste noir
262
		{
263
			if (distance > 2000 ) // || ) //bosse piste rouge 
264
			{
265
				// si trou dans la barriere ou zonesaut
266
			}
267
			else if (capteur == 0x6aff)
268
			{
269
				
270
			//	dly_tsk(1500);
271
				
272
			}
273
			else
274
			{
275
				distance1=distance;	 //cas normal: si on est au milieu de la piste angle des roues ? 0
276
        	}
277
  			comm.data.val=s*(distance1-706);
278
			snd_dtq(CanTx, comm.msg);
279
			 dly_tsk(20);
206 280
		}	
207
		else
208
		{
209
			distance1=distance; //cas normal: si on est au milieu de la piste angle des roues ? 0
210
        }
211
  		comm.data.val=s*(distance1-706);
212
  		snd_dtq(CanTx, comm.msg);      
281
  
282
			  
213 283
	}
284

  
214 285
}
215 286

  
216 287

  
......
226 297
		//commande vitesse vehicule
227 298
		requete.data.id='V';
228 299
		requete.data.rtr=0; 			//indique une ecriture
229
		if (capteur == 0x5602 || capteur == 0x5603 || capteur == 0x5601 )
230
		{
231
			requete.data.val=45;				// si trou dans la barriere ou zonesaut
232
		}	
233
		else
234
		{
235
			requete.data.val=15; //cas normal: si on n'est pas dans la zone de saut 
236
        } 
300
		switch (selecpiste){
301
			case 0x0001 :		// pour piste verte
237 302
		
303
				if (capteur == 0x5602 || capteur == 0x5603 || capteur == 0x5604 || capteur == 0x5605 || capteur == 0x5601  )
304
				{
305
					requete.data.val=70;				// ligne droite 
306
				}	
307
				else
308
				{
309
					requete.data.val=40; 				//virage
310
      	 		} 
311
			break;
312
			
313
			case 0x0002 :		// pour piste bleu
314
						
315
				if (capteur == 0x5602 || capteur == 0x5603 || capteur == 0x5605 || capteur == 0x5601  )
316
				{
317
					requete.data.val=60;				// ligne droite 
318
				}
319
				else if (capteur == 0x5604)
320
				{
321
					requete.data.val=50; 				//bosse
322
      	 		} 
323
				else
324
				{
325
					requete.data.val=25; 				//virage
326
      	 		} 
327
			break;
328
			
329
			case 0x0003 :		// pour piste rouge
330
				if (capteur == 0x5602 || capteur == 0x5603 || capteur == 0x5604 || capteur == 0x5605)
331
				{
332
					requete.data.val=60;				// ligne droite 
333
				}
334
				else if (capteur == 0x6aff)
335
				{
336
					requete.data.val=45; 				//bosse
337
      	 		} 
338
				else if (capteur == 0x5601)
339
				{
340
					requete.data.val=35;				// petit virage entr?e 
341
				}
342
				else if (capteur == 0x4203)
343
				{
344
					requete.data.val=10;				//  virage apr?s saut 
345
				}
346
				else
347
				{
348
					requete.data.val=25; 				//virage
349
      	 		} 
350
			break;
351
			
352
			case 0x0004 :		// pour piste noir
353
				if (capteur == 0x5602 || capteur == 0x5603 || capteur == 0x5604 || capteur == 0x5605)
354
					{
355
						requete.data.val=60;				// ligne droite 
356
					}
357
					else if (capteur == 0x6aff)
358
					{
359
						requete.data.val=45; 				//bosse
360
      	 			} 
361
					else if (capteur == 0x5601)
362
					{
363
						requete.data.val=35;				// petit virage entr?e 
364
					}
365
					else if (capteur == 0x4203)
366
					{
367
						requete.data.val=10;				//  virage apr?s saut 
368
					}
369
					else
370
					{
371
						requete.data.val=25; 				//virage
372
      	 			} 
373
			break;
374
			
375
		}
238 376
		
239 377
//		requete.data.val=25;			//vitesse constante
240
		
241
/*	vitesse variable	
242
		if (distance > 706)
243
		{
244
			requete.data.val=140-0.05*distance;				// a fond si vehicule au milieu sinon ralentit doucement
245
		}	
246
		else
247
		{
248
			requete.data.val=0.05*distance;  				//vitesse max=50=0.07*706
249
        }
250
*/
251
		
252
		
378

  
253 379
		snd_dtq(CanTx, requete.msg);
254
	//	dly_tsk(2);
380
		dly_tsk(20);
255 381
	}
256 382
}
257 383

  
......
263 389
        ports_mcu();
264 390
    lcd_init();
265 391
        periph_init();
266
        periph_nom("#AutoTest*");
392
        periph_nom("#AntoineMaincent*");
267 393
    can_init();
268 394
    clavier_init(1);
269 395
        capture_init();
......
271 397
        sta_tsk(ID_periph_rx);
272 398
        
273 399
		
274
		
400
		sta_tsk(ID_piste);
275 401
        sta_tsk(ID_tourelle);
276 402
        sta_tsk(ID_dist);
277 403
        sta_tsk(ID_roue);
branch/maincent/tp_info6/Emb_App/conf_noyau.cfg
86 86
};
87 87

  
88 88
task[]{
89
	entry_address	= piste();
90
	name	= ID_piste;
91
	stack_size	= 512;
92
	stack_section	= stack;
93
	priority	= 5;
94
	initial_start	= OFF;
95
	exinf	= 0x0;
96
};
97

  
98
task[]{
89 99
	entry_address	= vitesse();
90 100
	name	= ID_vitesse;
91 101
	stack_size	= 512;

Also available in: Unified diff