Révision 108
Ajouté par khmbaye il y a plus de 6 ans
branch/mbaye/Emb_App/programme_principal_etud.c | ||
---|---|---|
#include "can.h"
|
||
#include "carte_io.h"
|
||
#include "carte_m32.h"
|
||
#include <math.h>
|
||
#include <math.h>
|
||
int a;
|
||
|
||
// Potentiometre: lire les registres ad00 et ad01, les valeurs sont sur 10 bits.
|
||
|
||
... | ... | |
capture_init();
|
||
|
||
sta_cyc(ID_acqui);
|
||
// sta_tsk(ID_periph_rx);
|
||
sta_tsk(ID_periph_rx);
|
||
|
||
while(1)
|
||
{
|
||
LED_J=1;
|
||
/*LED_J=1;
|
||
dly_tsk(100);
|
||
LED_J=0;
|
||
dly_tsk(100);*/
|
||
CanFrame comm;
|
||
comm.data.id='T'; comm.data.rtr=0; comm.data.val=120;
|
||
snd_dtq (CanTx,comm.msg);
|
||
dly_tsk(100);
|
||
}
|
||
comm.data.id='R'; comm.data.rtr=1;
|
||
snd_dtq (CanTx,comm.msg);
|
||
a= periph[ADDR('R')].val;
|
||
if(a >90)
|
||
{
|
||
comm.data.id='T'; comm.data.rtr=0; comm.data.val=0;
|
||
snd_dtq (CanTx,comm.msg);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void acqui()
|
||
{
|
||
LED_V=!LED_V;
|
||
}
|
||
|
||
/*void envoi_commande()
|
||
{
|
||
CanFrame comm;
|
||
comm.data.id='T'; comm.data.rtr=0; comm.data.val=45;
|
||
snd_dtq (CanTx,comm.msg);
|
||
}*/
|
||
/*void reception_valeur()
|
||
{
|
||
CanFrame demande;
|
||
CanFrame reponse;
|
||
|
||
demande.data.id='R'; demande.data.rtr=1;
|
||
snd_dtq (CanTx,demande.msg); // Interrogation du peripherique
|
||
rcv_dtq (CanRx,&reponse.msg); // Attente de la reponse
|
||
a=reponse.data.val; //contient la valeur de retour du simulateur.
|
||
}*/
|
Formats disponibles : Unified diff
Rotation Tourelle + lecture de l'angle