Projet

Général

Profil

« Précédent | Suivant » 

Révision 141

Ajouté par casotty il y a plus de 6 ans

Obtention de la poisiton de la tourelle effective

Voir les différences:

branch/sotty/Emb_App/programme_principal_etud.c
// correspondant au nom du v?hicule si le nom se termine par '*'
void tourelle();
void rotation_tourelle();
short position_tourelle();
void main()
{
......
LED_J=0;
dly_tsk(100);
}*/
tourelle();
rotation_tourelle();
}
void acqui()
......
}
void tourelle()
void rotation_tourelle()
{
CanFrame comm;
comm.data.id = 'T';
comm.data.rtr = 0; //Ecriture
comm.data.val = 120; //Rotation de 12?/s
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
snd_dtq(CanTx, comm.msg);
dly_tsk(1000);
}
comm.data.val = 0; //Rotation nulle
snd_dtq(CanTx, comm.msg);
}
short position_tourelle()
{
CanFrame requete, reponse;
short angle;
requete.data.id = 'R'; //Position tourelle
requete.data.rtr = 1; //Lecture
snd_dtq(CanTx, requete.msg);
rcv_dtq(CanRx, &reponse.msg);
angle = reponse.data.val;
return angle;
}

Formats disponibles : Unified diff