Projet

Général

Profil

« Précédent | Suivant » 

Révision 57

Ajouté par jotoribio il y a plus de 6 ans

18'48 Record à battre

Voir les différences:

branch/toribio/Emb_App.tws
[GENERAL_DATA]
[BREAKPOINTS]
[OPEN_WORKSPACE_FILES]
"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_toribio\tp_info6\bsp\periph.c"
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\conf_noyau.cfg"
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\crt0mr.a30"
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\programme_principal_etud.c"
[WORKSPACE_FILE_STATES]
"E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 659 1 0
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\conf_noyau.cfg" 0 0 1380 424 0 3
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\crt0mr.a30" 125 125 1380 424 0 2
"E:\tp_info6_2018_toribio\tp_info6\Emb_App\programme_principal_etud.c" -8 -30 1596 731 1 0
"E:\tp_info6_2018_toribio\tp_info6\bsp\periph.c" 100 100 1380 424 0 1
[LOADED_PROJECTS]
"EmbM32C87App"
[END]
branch/toribio/Emb_App/programme_principal_etud.c
short alpha;
short distance;
short angleR;
void asserv0(){
short k=1; //Gain du correcteur P
//lecture de la position de la tourelle
CanFrame requete, reponse,comm;
requete.data.id='R';
requete.data.rtr=1; //indique une requete de lecture
snd_dtq(CanTx, requete.msg);
rcv_dtq(CanRx, &reponse.msg);
alpha=reponse.data.val;
//lecture de la position de la tourelle
CanFrame req,comm;
UINT flag;
req.data.id='R';
req.data.rtr=1;
periph[ADDR('R')].ev=0x01;
snd_dtq(CanTx, req.msg);
//Attente de la r?ponse
wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
alpha=periph[ADDR('R')].val;
//Commande vitesse de la tourelle
comm.data.id='T';
comm.data.rtr=0; //indique une ?criture
comm.data.val=k*(ad00-alpha);
snd_dtq(CanTx, comm.msg);
//Commande vitesse de la tourelle
comm.data.id='T';
comm.data.rtr=0; //indique une ?criture
comm.data.val=k*(450/*ou ad00*/-alpha);
snd_dtq(CanTx, comm.msg);
}
//lecture de la distance du mur
/*requete.data.id='U';
requete.data.rtr=1; //indique une requete de lecture
snd_dtq(CanTx, requete.msg);
rcv_dtq(CanRx, &reponse.msg);
distance=reponse.data.val;
*/
void dist(){
//lecture de la distance du mur
CanFrame req;
UINT flag;
req.data.id='U';
req.data.rtr=1;
periph[ADDR('U')].ev=0x02;
snd_dtq(CanTx, req.msg);
//Attente de la r?ponse
wai_flg (ev_periph, 0x02, TWF_ANDW, &flag);
distance=periph[ADDR('U')].val;
}
void roue(){
short k=2; //Gain du correcteur P
//lecture de la position de la roue
CanFrame req,comm;
UINT flag;
/*
req.data.id='D';
req.data.rtr=1;
periph[ADDR('D')].ev=0x01;
snd_dtq(CanTx, req.msg);
//Attente de la r?ponse
wai_flg (ev_periph, 0x01, TWF_ANDW, &flag);
angleR=periph[ADDR('D')].val;
*/
//Commande de l'angle de roue
comm.data.id='D';
comm.data.rtr=0; //indique une ?criture
comm.data.val=k*(distance-637);
snd_dtq(CanTx, comm.msg);
}
void demare(){
CanFrame requete;
//verif avec vitesse
dly_tsk(6000);
requete.data.id='V';
requete.data.rtr=0;
requete.data.val=45;
snd_dtq(CanTx, requete.msg);
}
void main()
{
......
capture_init();
sta_cyc(ID_acqui);
// sta_tsk(ID_periph_rx);
sta_tsk(ID_periph_rx);
//verif avec vitesse
requete.data.id='V';
requete.data.rtr=0;
requete.data.val=8;
snd_dtq(CanTx, requete.msg);
while(1)
{
LED_J=1;
/* LED_J=1;
dly_tsk(100);
LED_J=0;
dly_tsk(100);
dly_tsk(100);*/
sta_tsk(ID_demare);
sta_tsk(ID_asserv0);
sta_tsk(ID_dist);
sta_tsk(ID_roue);
}
}
branch/toribio/Emb_App/conf_noyau.cfg
};
task[]{
entry_address = dist();
name = ID_dist;
stack_size = 512;
stack_section = stack;
priority = 6;
initial_start = OFF;
exinf = 0x0;
};
task[]{
entry_address = roue();
name = ID_roue;
stack_size = 512;
stack_section = stack;
priority = 7;
initial_start = OFF;
exinf = 0x0;
};
task[]{
entry_address = demare();
name = ID_demare;
stack_size = 512;
stack_section = stack;
priority = 7;
initial_start = OFF;
exinf = 0x0;
};
task[]{
entry_address = periph_tx();
name = ID_periph_tx;
stack_size = 256;
branch/toribio/Emb_App.hws
[DATABASE_VERSION]
"11.0"
[WORKSPACE_DETAILS]
"Emb_App" "E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6" "E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6\Emb_App.hws" "M16C/80,M32C" "Renesas M32C Standard"
"Emb_App" "E:\tp_info6_2018_toribio\tp_info6" "E:\tp_info6_2018_toribio\tp_info6\Emb_App.hws" "M16C/80,M32C" "Renesas M32C Standard"
[SHARED_WORKSPACE_CONTROL_STATUS]
"" "" ""
"" "" ""
[PROJECTS]
"EmbM32C87App" "E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6\Emb_App" "E:\programmation\Travaux_Pratiques\Polytech_Ge_Travaux_Pratiques_2018\polytech-ge-info6-2018\trunk\tp_info6\Emb_App\EmbM32C87App.hwp" 4
"EmbM32C87App" "E:\tp_info6_2018_toribio\tp_info6\Emb_App" "E:\tp_info6_2018_toribio\tp_info6\Emb_App\EmbM32C87App.hwp" 4
[INFORMATION]
"No workspace information available"
[SCRAP]

Formats disponibles : Unified diff