Hello World for nxtOSEK

 

An example to display "Hello, World!" and Sensors/Motors status on the LCD screen. While this application is running, user also can monitor Servo Motor revolutions, Touch/Light/Sound/Ultrasonic Sensors data, and NXT internal data including system tick, battery voltage on the LCD screen.

Since V1.08, if you didn't need to use TOPPERS ATK hooks and nxtOSEK hooks, you would not need to define them in the code because of these functions in liblejososek.a library are linked.

samples\helloworld\helloworld.c

/* helloworld.c */
#include "kernel.h"
#include "ecrobot_interface.h"

/* nxtOSEK hook to be invoked from an ISR in category 2 */
void user_1ms_isr_type2(void){ /* do nothing */ }

TASK(OSEK_Task_Background)
{
  while(1){
    ecrobot_status_monitor("Hello, World!");
    systick_wait_ms(500); /* 500msec wait */
  }
}

samples\helloworld\helloworld.oil

#include "implementation.oil"

CPU ATMEL_AT91SAM7S256
{
  OS LEJOS_OSEK
  {
    STATUS = EXTENDED;
    STARTUPHOOK = FALSE;
    ERRORHOOK = FALSE;
    SHUTDOWNHOOK = FALSE;
    PRETASKHOOK = FALSE;
    POSTTASKHOOK = FALSE;
    USEGETSERVICEID = FALSE;
    USEPARAMETERACCESS = FALSE;
    USERESSCHEDULER = FALSE;
  };

  /* Definition of application mode */
  APPMODE appmode1{};

  /* Definition of OSEK_Task_Background */
  TASK OSEK_Task_Background
  {
    AUTOSTART = TRUE
    {
      APPMODE = appmode1;
    };
    PRIORITY = 1; /* lowest priority */
    ACTIVATION = 1;
    SCHEDULE = FULL;
    STACKSIZE = 512;
  };
};

 

 

 

Back to Samples