Wiki source for NutOS


Show raw source

=====""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


==a==Thread-Priorität==a==

- 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


==a==Thread anlegen==a==

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

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

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


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


==a==Sleep-Funktionen==a==


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.


==a==Timer==a==

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.


==a==Zeit-Funktionen==a==

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.


==a==Timer==a==

==a==Netzwerk==a==

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



----
Siehe auch {{backlinks}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki