Révision 155
Ajouté par naidzim1 il y a plus de 6 ans
branch/najib_idzim/tp_info6/Emb_App/SessionM32C_E8a_system.BKS | ||
---|---|---|
"Help" "TOOLBAR 0" 59419 2 4 "0.00" 0 0 0 0 0 17 0 "" "0.0"
|
||
"{WK_00000001_CmdLine}" "WINDOW" 59422 0 0 "0.14" 365 0 0 350 200 17 0 "32771|32772|32778|<<separator>>|32773|32774|<<separator>>|32820|<<separator>>|32801|32824" "0.0"
|
||
"{WK_00000001_DISASSEMBLY}" "WINDOW" 0 0 0 "0.00" 0 -4 -30 948 486 9 0 "" "0.0"
|
||
"{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.16" 365 0 0 350 200 18 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0"
|
||
"{WK_00000001_EVENT}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 0 "0.68" 365 0 0 350 200 2065 0 "32774|32775|32777|<<separator>>|32780|<<separator>>" "0.0"
|
||
"{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"
|
||
"{WK_00000001_OUTPUT}" "WINDOW" 59422 0 1 "1.00" 365 0 0 350 200 18 0 "36756|36757|36758|36759|<<separator>>|36746|36747|<<separator>>|39531|<<separator>>|39500|39534|<<separator>>|36687" "0.0"
|
||
"{WK_00000001_PDMR}EmbM32C87AppSessionM32C_E8a_system" "WINDOW" 59422 0 3 "0.15" 365 0 0 350 200 18 0 "47300|47301|47302|47303|47304|47305|47314|47306|47307|47308|47311|47312|47313|42211|42509|42303" "0.0"
|
branch/najib_idzim/tp_info6/Emb_App/programme_principal_etud.c | ||
---|---|---|
//'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
|
||
// correspondant au nom du v?hicule si le nom se termine par '*'
|
||
|
||
void vitesseTourelle(int vitesse);
|
||
void vitesseTourelle(int vitesse); //vitesse en 10e de degre/sec
|
||
unsigned short lirePosTourelle(); // position en 10e de degre
|
||
void asserv_pos_tour();
|
||
|
||
void main()
|
||
{
|
||
|
||
unsigned short posTourelle = 0;
|
||
|
||
ports_mcu();
|
||
lcd_init();
|
||
periph_init();
|
||
periph_nom("#AutoTest*");
|
||
periph_nom("#Ferrari*");
|
||
|
||
can_init();
|
||
clavier_init(1);
|
||
... | ... | |
// sta_tsk(ID_periph_rx);
|
||
|
||
|
||
|
||
|
||
while(1)
|
||
{
|
||
asserv_pos_tour();
|
||
|
||
vitesseTourelle (400);
|
||
while(1)
|
||
{
|
||
LED_J=1;
|
||
dly_tsk(100);
|
||
LED_J=0;
|
||
dly_tsk(100);
|
||
|
||
}
|
||
}
|
||
... | ... | |
void vitesseTourelle(int vitesse)
|
||
{
|
||
CanFrame comm;
|
||
|
||
comm.data.id = 'T';
|
||
comm.data.rtr = 0; //ecriture
|
||
comm.data.val = vitesse;
|
||
|
||
snd_dtq (CanTx,comm.msg);
|
||
}
|
||
|
||
unsigned short lirePosTourelle()
|
||
{
|
||
CanFrame requete, reponse;
|
||
|
||
requete.data.id = 'R';
|
||
requete.data.rtr = 1; // Requete de lecture
|
||
snd_dtq(CanTx, requete.msg);
|
||
|
||
rcv_dtq(CanRx, &reponse.msg);
|
||
|
||
return reponse.data.val;
|
||
}
|
||
|
||
void asserv_pos_tour()
|
||
{
|
||
unsigned short pos;
|
||
pos = lirePosTourelle();
|
||
|
||
|
||
|
||
if (pos < 425)
|
||
{
|
||
vitesseTourelle (800);
|
||
}
|
||
else if (pos >= 425 && pos < 450 )
|
||
{
|
||
vitesseTourelle (50);
|
||
}
|
||
else if (pos = 450)
|
||
{
|
||
vitesseTourelle(0);
|
||
}
|
||
else if (pos > 450 && pos <= 475)
|
||
{
|
||
vitesseTourelle(-50);
|
||
}
|
||
else if (pos > 475)
|
||
{
|
||
vitesseTourelle(-800);
|
||
}
|
||
}
|
Formats disponibles : Unified diff
Implantation asservissement position tourelle