-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Le cas de communication samd21 et raspberry ne fonctionne pas #121
Comments
Bonjour,
Quel problème?
Bonne journée,
|
Aucune donnée n'est envoyée. Je ne connaissais pas de solution. |
Quelle est la description OIL de la tâche STask ? |
OIL_VERSION = "2.5"; IMPLEMENTATION trampoline { CPU blink {
}; APPMODE std {}; TASK measureTask { ALARM activatePeriodic { TASK timeoutTask { ALARM activateTimeout { TASK displayTask { ALARM activateDisplay { TASK STask { ALARM comTASK { ISR triggerISR { }; |
Ajoutez un affichage sur l'OLED dans STask pour savoir si cette tâche s'exécute. |
pour le moment je ne l'ai pas . |
Je n'ai pas compris votre réponse. Vous n'avez pas quoi ? |
afficheur OLED |
Dans ce cas, changez l'état d'une des LED de la carte. |
Même problème, pouvez-vous voir si le code est correct ? |
Je ne reçois pas vos email (je ne sais pas pourquoi). Vous pouvez attacher des fichiers ici. |
C'est tout fichier avec toutes les librairies |
Vous n'avez pas ajouté le clignotement de la LED ? Vous n'avez pas la carte sous la main ? |
Je veux savoir si cette tâche s'exécute. Ajoutez un clignotement de LED dans STask. Et testez avant que la LED clignote bien dans une tâche que vous savez s'exécuter correctement. |
j'ai essayé plusieurs fois mais malheureusement j'ai aucun fonctionnalités dans Stask |
|
/ # Essalamou Alaikom . // j'ai fait dans tout les task une led au fonctionne normal Cordialement. |
Pouvez-vous aider à résoudre un problème !
#include "tpl_os.h"
//the READY tasks state definition conflicts with registers definition (in sam.h)
#undef READY
#include "sam.h"
#include <pinAccess.h>
#include "board/iutNantes/include/timer.h"
#include "board/iutNantes/include/oled.h"
#include <eic.h>
#include "serial.h"
#include <errno.h>
#include <stdio.h> //printf
//distance en cm.
volatile unsigned int range;
int main(void)
{
pinMode(PORTB,9,OUTPUT); //TRIGGER pin
pinMode(PORTB,15,INPUT); //ECHO pin
EICInitClock(F1MHZ);
TCinitClock(F1MHZ,3); //1 pulse/us
OLEDInit(0);
SERIALInit(115200);
range = 0;
StartOS(OSDEFAULTAPPMODE);
return 0;
}
TASK(displayTask)
{
OLEDSetLine(0);
OLEDPrintString("distance ");
OLEDPrintInt(range,3);
OLEDPrintString("cm.");
TerminateTask();
}
TASK(timeoutTask)
{
OLEDSetLine(0);
OLEDPrintInt(range,3);
OLEDPrintString(" Pas de capteur!");
TerminateTask();
}
TASK(measureTask)
{
//trigger
digitalWrite(PORTB,9,1);
for(volatile int i=0;i<1000;i++);
digitalWrite(PORTB,9,0);
}
ISR(triggerISR)
{
if(digitalRead(PORTB,15) == 1)
{
//front montant. Lancement timer TC3.
TC3->COUNT16.COUNT.reg = 0; //init val
TC3->COUNT16.CTRLA.reg = 2; //run, sans prescaler.
} else {
unsigned int mes = TC3->COUNT16.COUNT.reg; //1 tick/us
range = mes/58; //conversion en cm.
TC3->COUNT16.CTRLA.reg = 0; //arret (non necessaire)
}
typedef struct {
uint16_t id; // ID du capteur
uint16_t value; // Valeur du capteur
} SensorData;
TASK(STask){
SensorData sensorData;
sensorData.id = 1; // ID du capteur
sensorData.value = range; // Valeur du capteur
char s[5]={'s','s','s','s','s'};
SERIALPutString(s); // Envoi du message initial
for (int i = 0; i < sizeof(sensorData); i++) {
SERIALPutchar(((uint8_t)&sensorData + i));}
TerminateTask();
}
The text was updated successfully, but these errors were encountered: