Skip to main content
  • 产品
  • Software evaluation
  • 下载
  • Free utilities
  • 购买
  • 芯片厂商
  • 支持
  • 关于我们
  • Search
  • 工作机会
  • 新闻简报
  • 联系我们
  • embOS
  • embOS example application

    embOS RTOS example application

    The following example shows the ease of use of the embedded RTOS, embOS, for real-time applications.

    Contact us
    Downloads
    Documentation
    SEGGER embOS

    Easy RTOS task scheduling

    This sample application highlights basic RTOS scheduling. The two tasks are activated and execute until they run into the delay (a form of context switching in an RTOS), then suspend for the specified time and eventually continue execution.

    You can write programs just as you always did, the only difference being that multiple programs run quasi-simultaneously as managed tasks. This demonstrates the core of task scheduling in RTOS.

    #include "RTOS.h"
    
    static OS_STACKPTR int StackHP[128], StackLP[128];  // Task stacks
    static OS_TASK         TCBHP, TCBLP;                // Task-control-blocks
    
    static void HPTask(void) {
      while (1) {
        OS_TASK_Delay(50);
      }
    }
    
    static void LPTask(void) {
      while (1) {
        OS_TASK_Delay(200);
      }
    }
    
    int main(void) {
      OS_Init();    // Initialize OS
      OS_InitHW();  // Initialize Hardware for OS
      OS_TASK_CREATE(&TCBHP, "HP Task", 100, HPTask, StackHP);
      OS_TASK_CREATE(&TCBLP, "LP Task",  50, LPTask, StackLP);
      OS_Start();   // Start multitasking
      return 0;
    }
    
    • User manual
    • Online documentation
    • Knowledge Base
    • List of downloads
    • Release notes
    • Update notification
    • Pricing
    • Support
    • Silicon vendor resources

    全球总部

    德国: SEGGER Microcontroller GmbH

    地址: Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    电邮: info@segger.com
    电话: +49-2173-99312-0
    传真: +49-2173-99312-28

    网点分布

    中国:哲戈微系统科技(上海)有限公司

    地址: 中国上海市闵行区秀涟路133号
    大虹桥国际A 栋218室
    邮编201199
    电邮: china@segger.com
    电话: +86-133-619-907-60


    简易信息聚合

    通过ISO 9001认证

    ISO 9001

    通过ISO 27001认证

    ISO 27001

    30多年的嵌入式行业经验

    First-class embedded software tools since 1992
    • 版本说明
    • 免责声明
    • 行为准则
    • 隐私策略
    • 沪ICP备2022005181号
    • 沪公网安备 31011202014525号
    © 2026 SEGGER - 版权所有.

    您即将离开 segger.cn 而访问境外网站,是否继续?