Révision 147
Ajouté par casotty il y a plus de 6 ans
branch/sotty/Emb_App/programme_principal_etud.c | ||
---|---|---|
// correspondant au nom du v?hicule si le nom se termine par '*'
|
||
|
||
|
||
void rotation_tourelle();
|
||
short position_tourelle();
|
||
void rotation_tourelle(void);
|
||
short position_tourelle(void);
|
||
void asserv_tourelle(VP_INT stacd);
|
||
|
||
void main()
|
||
{
|
||
... | ... | |
clavier_init(1);
|
||
capture_init();
|
||
|
||
sta_cyc(ID_acqui);
|
||
sta_cyc(ID_acqui);
|
||
sta_tsk(ID_asserv_tourelle);
|
||
// sta_tsk(ID_periph_rx);
|
||
|
||
/* while(1)
|
||
while(1)
|
||
{
|
||
LED_J=1;
|
||
dly_tsk(100);
|
||
LED_J=0;
|
||
LED_J=0;
|
||
rotation_tourelle();
|
||
dly_tsk(100);
|
||
}*/
|
||
rotation_tourelle();
|
||
}
|
||
}
|
||
|
||
void acqui()
|
||
... | ... | |
{
|
||
CanFrame comm;
|
||
|
||
while(position_tourelle()<300){ //Rotation de la tourelle tant que sa position est < ? 300 (sur 1023)
|
||
comm.data.id = 'T';
|
||
comm.data.rtr = 0; //Ecriture
|
||
comm.data.val = 120; //Rotation de 12?/s
|
||
snd_dtq(CanTx, comm.msg);
|
||
dly_tsk(1000);
|
||
}
|
||
comm.data.val = 0; //Rotation nulle
|
||
comm.data.id = 'T';
|
||
comm.data.rtr = 0; //Ecriture
|
||
comm.data.val = 120; //Rotation de 12?/s
|
||
snd_dtq(CanTx, comm.msg);
|
||
}
|
||
|
||
|
||
short position_tourelle()
|
||
{
|
||
short position_tourelle(){
|
||
//Renseigne sur la position de la tourelle (angle en dizieme de degre)
|
||
CanFrame requete, reponse;
|
||
short angle;
|
||
|
||
... | ... | |
angle = reponse.data.val;
|
||
|
||
return angle;
|
||
}
|
||
}
|
||
|
||
void asserv_tourelle(VP_INT stacd){
|
||
//Maintient de la tourelle orientee a 45 degre
|
||
CanFrame comm;
|
||
char K = 2;
|
||
|
||
while(1){
|
||
comm.data.id = 'T'; //Rotation de la tourelle
|
||
comm.data.rtr = 0; //Ecriture
|
||
comm.data.val = K*(450 - position_tourelle()); //Rotation
|
||
snd_dtq(CanTx, comm.msg);
|
||
}
|
||
}
|
branch/sotty/Emb_App/conf_noyau.cfg | ||
---|---|---|
//
|
||
// kernel.cfg : building file for MR308 Ver.4.00
|
||
//
|
||
// Generated by M3T-MR308 GUI Configurator at 2013/01/08 15:28:33
|
||
// Generated by M3T-MR308 GUI Configurator at 2018/12/05 15:47:07
|
||
//
|
||
////////////////////////////////////////////////////////////////////////////////
|
||
|
||
... | ... | |
max_task = 3;
|
||
max_flag = 3;
|
||
max_dtq = 2;
|
||
max_cyh = 1;
|
||
max_cyh = 2;
|
||
max_vdtq = 1;
|
||
};
|
||
|
||
... | ... | |
initial_start = OFF;
|
||
exinf = 0x0;
|
||
};
|
||
task[]{
|
||
entry_address = asserv_tourelle();
|
||
name = ID_asserv_tourelle;
|
||
stack_size = 256;
|
||
stack_section = stack;
|
||
priority = 5;
|
||
initial_start = OFF;
|
||
exinf = 0x0;
|
||
};
|
||
|
||
flag[]{
|
||
name = ev_bus_fin_tr;
|
||
... | ... | |
};
|
||
|
||
|
||
|
||
vdataqueue[]{
|
||
name = QdmTouche;
|
||
wait_queue = TA_TFIFO;
|
Formats disponibles : Unified diff
Tache d'asservissement de la tourelle effective