NutOS


NutOS is an intentionally simple RTOS for the AtmelAvr ATmega128, which provides a minimum of services to run Nut/Net, the TCP/IP stack. NutOS verwende ich auf dem WebCAT WebCAT-Board für das RapidAccessTerminal Rapid Access Terminal.

http://www.ethernut.de/en/software/index.html


1. Thread-Priorität

  • 255 to kill the thread
  • 0 specifies the highest priority
  • The idle thread is running at level 254 (lowest priority)
  • Application threads should use levels from 32 to 253
  • Standard für einen neuen Thread ohne Angabe der Priorität ist 64

Quelle: http://www.ethernut.de/api/group__xg_thread.html


2. Thread anlegen


Der Thread wird definiert durch das Schlüsselwort THREAD. Man definiert gleich am Anfang eines Threads die Thread-Priorität.
 #include <sys/thread.h>

THREAD(taskLed, arg)
{
       NutThreadSetPriority(63);  

    for(;;)
    {
         LED_TOGGLE;
         NutSleep(500);
    };
}



Der Start des Thread erfolgt durch den folgenden Code
NutThreadCreate("LED", taskLed, 0, 640);



3. Sleep-Funktionen



Mit NutSleep() gibt der Thread die gibt man den anderen Threads

void NutMicroDelay (uint32_t us)
Loop for a specified number of microseconds.
void NutDelay (uint8_t ms)
Loop for a specified number of milliseconds.


4. Timer


Zyklisch eine Funktion aufrufen

NUTTIMERINFO * NutTimerCreate (uint32_t ticks, void(*callback)(HANDLE, void *), void *arg, uint8_t flags)
Create a new system timer.
HANDLE NutTimerStartTicks (uint32_t ticks, void(*callback)(HANDLE, void *), void *arg, uint8_t flags)
Start a system timer.
HANDLE NutTimerStart (uint32_t ms, void(*callback)(HANDLE, void *), void *arg, uint8_t flags)
Start a system timer.


5. Zeit-Funktionen


Sehr nützlich sind auch die Zeit-Funktionen

uint32_t NutGetTickCount (void)
Return the number of system timer ticks.
uint32_t NutGetSeconds (void)
Return the seconds counter value.
uint32_t NutGetMillis (void)
Return the milliseconds counter value.


6. Timer


7. Netzwerk


UDP
http://www.ethernut.de/nutwiki/Basic_UDP_Server




Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki