Forum: Mikrocontroller und Digitale Elektronik PIC xc8 Problem mit "time"


von Martin M. (ats3788)


Lesenswert?

Hallo
Ich habe ein triviales Problem mit
PIC 8 bit C XC8

Bei time mäkelt der Compiler
"Kenne ich nicht"

:0: error: undefined symbol:
        _time(dist/default/debug\Dice.X.debug.obj)

Das dumme ist, es hat mal funktioniert , dann habe ich was geändert
und nun habe ich große Augen und weiß nicht weiter.


#include <time.h>

//// Unterfuntion
int GetRandom() {
    time_t toc;
     time(&toc); // <<<<<<< hier

     srand((int)toc);

     srand(toc);

    int zahl = rand ();
        return(zahl);
}

von Dr. Sommer (Gast)


Lesenswert?

Läuft auf dem Controller denn ein Betriebssystem das die Zeit verwaltet 
mithilfe einer RTC? Wenn nein, wo soll dann die Zeit herkommen?

von Kein Name (Gast)


Lesenswert?

Die XC8 Doku hat da eine klare Aussage.

Note
The time() routine is not supplied, if required the user will have to 
implement this routine to the specifications outlined above.

von Martin M. (ats3788)


Lesenswert?

OK das heißt eine Time Funktion muß erst implementiert werden.
Ich dachte das geht über den timer.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.