Projet

Général

Profil

« Précédent | Suivant » 

Révision 530

Ajouté par aueuphrasi il y a plus de 6 ans

MAJ avant eval

Voir les différences:

branch/euphrasie_auguste/Emb_App/SessionM32C_E8a_system.ini
[Target]
M32C E8a SYSTEM=Renesas Communications
[USER_DATA]
RESET=ff0048
RESET=ff0074
branch/euphrasie_auguste/Emb_App/programme_principal_etud.c
void asser_roue_vitesse(VP_INT c);
void idle(VP_INT d);
void capteur(VP_INT e);
void LED_JAUNE(VP_INT f);
void LED_JAUNE(VP_INT f);
void ecran(VP_INT g);
void decode_int(void);
//short i;//** **
short touche;
short clavier;
short consigne_T = 450;
float k_T = 2.0;
short commande_T;
......
unsigned short deux_sec = 0;
unsigned short R_cyc_LED_V = 0;
unsigned short cyc_LED = 0;
unsigned short Bp_G_prec = 0;
unsigned short Bp_G_prec = 0;
unsigned char str_l1[17] = {'C','H','A','R','G','E',' ','C','P','U',' ','=',' ','9','9','%',0};
unsigned char str_l2[14] = {'C','I','R','C','U','I','T',' ','V','E','R','T',' ',0};
unsigned char str_l3[14] = {'C','A','P','T','E','U','R',' ','V','E','R','T',' ',0};
unsigned char str_l4[] = {};
void main(VP_INT a)
{
initialisation();//*
......
consigne_T = 450;
nb_tour = 1;//**
periph_nom("#Auguste*");
str_l2[8] = 'V';
str_l2[9] = 'E';
str_l2[10] = 'R';
str_l2[11] = 'T';
str_l2[12] = ' ';
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} //** // attente feux vert
periph_command('D', 0);//**
periph_command('V', 60);
dly_tsk(250);//***************************************
while((num_piste == 1) || (num_piste == 5)){
//***** ****** ***** ***** *****
consigne_T = 450;
switch(coul_cap_touch)//*
{
case 86: //ligne droite 'V'
......
consigne_T = 450;
periph_nom("#Auguste*");
nb_tour = 1;
str_l2[8] = 'B';
str_l2[9] = 'L';
str_l2[10] = 'E';
str_l2[11] = 'U';
str_l2[12] = ' ';
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} // attente feux vert
nb_tour = 1;
periph_command('D', 0);
periph_command('V', 60);
dly_tsk(250);
while((num_piste == 2) || (num_piste == 6)){
consigne_T = 450;
switch(coul_cap_touch)
{
case 86: //ligne droite
......
void terrain_rouge(void){
while((num_piste == 3) || (num_piste == 7)){
consigne_T = 450;
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} // attente feux vert
nb_tour = 1;
periph_nom("#Auguste*");
consigne_T = 450;
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} // attente feux vert
str_l2[8] = 'R';
str_l2[9] = 'O';
str_l2[10] = 'U';
str_l2[11] = 'G';
str_l2[12] = 'E';
while((num_piste == 3) || (num_piste == 7)){
consigne_T = 450;
switch(coul_cap_touch)
{
case 86: //ligne droite
distance_centre = 500;
if(num_cap_touch == 1){ //saut
commande_V_max = 65;
commande_V_max = 70;
k_D = 0.8;//**
}
else if(num_cap_touch == 3){ //saut
......
case 67 : //virage
k_D = 1.85;
distance_centre = 500;
if(num_cap_touch == 3){commande_V_max = 10;} //saut
else{commande_V_max = 30;}
if(num_cap_touch == 3){
commande_V_max = 10;
k_D = 2.1;
} //saut
else{commande_V_max = 25;}
break;
default :
k_D = 1.45;
......
void terrain_noir(void){
while((num_piste == 4) || (num_piste == 8)){
consigne_T = 450;
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} // attente feux vert
nb_tour = 1;
periph_nom("#Auguste*");
consigne_T = 450;
while((periph_requete('M') >> 15) == 0 ){commande_V_max = 0; dly_tsk(50);} // attente feux vert
str_l2[8] = 'N';
str_l2[9] = 'O';
str_l2[10] = 'I';
str_l2[11] = 'R';
str_l2[12] = 'E';
while((num_piste == 4) || (num_piste == 8)){
switch(coul_cap_touch)
{
......
commande_V_max = 20;
break;
case 3:
consigne_T = 450;
consigne_T = 350;
k_D = 1.75;
distance_centre = 600;
commande_V_max = 11;
......
}
void decode_int(void){
//short i = 0;
//while(touche != '#'){
//vrcv_dtq(QdmTouche,&touche);
//clavier = touche-48;//*
//i++;
//}
void ecran(VP_INT g){
while(1){
str_l1[13] = (CPU_charge/1000) + 48;
str_l1[14] = ((CPU_charge/100) - ((CPU_charge/1000) * 10)) + 48;
lcd_com(0x80);
lcd_str(str_l1);
if((Bp_G == 0) || (nb_tour < 4) || (Bp_D == 0)){
lcd_com(0xC0);
lcd_str(str_l2);
dly_tsk(250);
lcd_com(0x90);
lcd_str(str_l3);
//lcd_com(0xD0);
//lcd_str(str_l4);
}
dly_tsk(250);
}
}
void initialisation(void){
ports_mcu();
dly_tsk(1500);
......
sta_tsk(ID_assser_tourelle);
sta_tsk(ID_asser_roue_vitesse);
sta_tsk(ID_capteur);
sta_tsk(ID_LED_JAUNE);
sta_tsk(ID_LED_JAUNE);
sta_tsk(ID_ecran);
//sta_cyc(ID_LED_VERTE);
}
void assser_tourelle(VP_INT b){
while(1){
ang_T = periph_requete('R');
commande_T = k_T * (consigne_T - ang_T);
periph_command('T', commande_T);//**
dly_tsk(25);
}
void assser_tourelle(VP_INT b){
while(1){
if((Bp_G == 1) || (nb_tour >= 4)){
periph_command('T', 0);
}
else{
ang_T = periph_requete('R');
if(Bp_M == 1){
consigne_T = ad01;
}
commande_T = k_T * (consigne_T - ang_T);
periph_command('T', commande_T);//**
}
dly_tsk(8);
}
}
void asser_roue_vitesse(VP_INT c){
while(1){
dist_mur_droit = periph_requete('U')*sin((3.1415f*(periph_requete('R')))/1800.0f);
if(((abs(dist_mur_droit) > 1500)) || ((abs(dist_mur_droit) == 0))){
dist_mur_droit = distance_centre;
Led_jaune_event = 1;
}
commande_D = k_D * (dist_mur_droit - distance_centre);
if(commande_D < -450) commande_D = -450;
if(commande_D > 450) commande_D = 450;
periph_command('D', commande_D);
if(nb_tour >= 4){
void asser_roue_vitesse(VP_INT c){
while(1){
if((Bp_G == 1) || (nb_tour >= 4)){
commande_V_max = 0;
periph_command('V', commande_V_max);
if(Bp_G == 1){
LED_R = 1;
}
else{
LED_R = 0;
}
}
periph_command('V', commande_V_max);
dly_tsk(25);
}
else{
LED_R = 0;
dist_mur_droit = periph_requete('U')*sin((3.1415f*(periph_requete('R')))/1800.0f);//*** ***
if(((abs(dist_mur_droit) > 1500)) || ((abs(dist_mur_droit) == 0))){
dist_mur_droit = distance_centre;
Led_jaune_event = 1;
}
commande_D = k_D * (dist_mur_droit - distance_centre);
if(commande_D < -450) commande_D = -450; //*** clip minmax
if(commande_D > 450) commande_D = 450;
periph_command('D', commande_D);
if(Bp_M == 1){
commande_V_max = ad00/20;
}
periph_command('V', commande_V_max);//***
}
dly_tsk(8);
}
}
void idle(VP_INT d){
while(1){
......
idle_ctr = 0;
}
void capteur(VP_INT e){
while(1){
coul_cap_touch = (periph_requete('C') >> 8);
num_cap_touch_prec = num_cap_touch;
num_cap_touch = (periph_requete('C') & 0x00FF);
if((coul_cap_touch != coul_cap_touch_prec) && (num_cap_touch != num_cap_touch_prec)){ zone_diff = 1; }
if((num_cap_touch == 5) && (num_cap_touch != num_cap_touch_prec)){ nb_tour++; } //*
while(1){
if((Bp_G == 0) || (nb_tour < 4)){
coul_cap_touch = (periph_requete('C') >> 8);
num_cap_touch_prec = num_cap_touch;
num_cap_touch = (periph_requete('C') & 0x00FF);
if((coul_cap_touch != coul_cap_touch_prec) && (num_cap_touch != num_cap_touch_prec)){ zone_diff = 1; }
if((num_cap_touch == 5) && (num_cap_touch != num_cap_touch_prec)){ nb_tour++; } //*
switch(coul_cap_touch){
case 86:
str_l3[8] = 'V';
str_l3[9] = 'E';
str_l3[10] = 'R';
str_l3[11] = 'T';
str_l3[12] = ' ';
break;
case 82:
str_l3[8] = 'R';
str_l3[9] = 'O';
str_l3[10] = 'U';
str_l3[11] = 'G';
str_l3[12] = 'E';
break;
case 66:
str_l3[8] = 'B';
str_l3[9] = 'L';
str_l3[10] = 'E';
str_l3[11] = 'U';
str_l3[12] = ' ';
break;
case 74:
str_l3[8] = 'J';
str_l3[9] = 'A';
str_l3[10] = 'U';
str_l3[11] = 'N';
str_l3[12] = 'E';
break;
case 67:
str_l3[8] = 'C';
str_l3[9] = 'Y';
str_l3[10] = 'A';
str_l3[11] = 'N';
str_l3[12] = ' ';
break;
}
}
dly_tsk(25);
}
}
branch/euphrasie_auguste/Emb_App/conf_noyau.cfg
phs_counter = 0x0;
};
task[]{
entry_address = ecran();
name = ID_ecran;
stack_size = 512;
stack_section = stack;
priority = 8;
initial_start = OFF;
exinf = 0x0;
};
......
task[]{
entry_address = periph_tx();
name = ID_periph_tx;

Formats disponibles : Unified diff