Moin, ich krame diesen Threat mal aus, da ich ein ähnliches Problem hab:
Ich möchte eine kontrollierte zeit lang eine Schleife ausführen und danach eine kontrollierte zeit lang eine andere Schleife ausführen.
ich hab mir verschiedene Threats durchgelesen und die hier beschriebene Lösung war die, die ich am meisten Verstand^^
Ich habe in der asuro.c folgendes geändert:
von:
Code:
volatile unsigned char count72kHz;
/* uses timer2 (36kHz for IR communication */
/* counts falling and rising edge => 36kHz*2 = 72kHz */
SIGNAL (SIG_OUTPUT_COMPARE2)
{
count72kHz ++;
}
in:
Code:
volatile unsigned char count72kHz;
volatile int flag = 0;
/* uses timer2 (36kHz for IR communication */
/* counts falling and rising edge => 36kHz*2 = 72kHz */
SIGNAL (SIG_OUTPUT_COMPARE2)
{
count72kHz ++;
flag=count72kHz;
}
Im Hauptprogramm sieht das bei mir folgendermaßen aus:
Code:
#include "asuro.h"
#include "Funktionen.h"
#define XGRENZE 630 //560 ohne Motoren
#define YGRENZE 650 //573 ohne Motoren
int main(void)
{
int count72kHz;
Init();
while (flag<72000)
{
StatusLED(GREEN);
WaitM(50);
StatusLED(RED);
WaitM(50);
}
flag = 0;
while (flag<144000)
{
StatusLED(GREEN);
WaitM(500);
StatusLED(RED);
WaitM(500);
}
while(1);
return 0;
}
Das ding ist, beim compilieren sagt der mir, das die variable flag unbekannt ist.
wie bekomm ich das hin?
was mache ich genau falsch?
Lesezeichen