Connect with us

Real Time OS Program Code based ARM Development Suite

Discussion in 'Microcontrollers, Programming and IoT' started by limesp, Apr 22, 2013.

Scroll to continue with content
  1. limesp

    limesp

    1
    0
    Apr 22, 2013
    Hi All,

    I am new to Real Time OS. Can anyone explain the code stated as below to me in details?

    First part:
    OS_STK MainTaskStk[MainTaskStkLengh];
    OS_STK Task0Stk [Task0StkLengh]; // Define the Task0 stack
    OS_STK Task1Stk [Task1StkLengh]; // Define the Task1 stack
    OS_STK Task2Stk [Task2StkLengh]; // Define the Task2 stack


    Second part:
    #define rGPKCON0 (*(volatile unsigned *)(0x7F008800))
    #define rGPKCON1 (*(volatile unsigned *)(0x7F008804))
    #define rGPKDAT (*(volatile unsigned *)(0x7F008808))
    #define rGPKPUD (*(volatile unsigned *)(0x7F00880C))


    void Port_Init(void)
    {
    rGPKCON0 = (rGPKCON0 & ~(0xffffU<<16))|(0x1111U<<16);
    rGPKPUD = (rGPKPUD & ~(0xffU << 8))|(0x00U<<8);
    }

    void Led_Display(int data)
    {
    rGPKDAT = (rGPKDAT & ~(0xf<<4)) | ((data & 0xf)<<4);
    }

    void Task2 (void *pdata)
    {
    Port_Init();

    while(1)
    {
    OSPrintf("this is from task2\n");
    Led_Display(0x9); // 1001
    OSTimeDly(OS_TICKS_PER_SEC/4);
    Led_Display(0x6); // 0110
    OSTimeDly(OS_TICKS_PER_SEC/4);
    }
    }


    Third part:
    - How to create Task 3?


    Fourth part:
    - There are four leds in hardware. How led blinking based on Task0,Task1 and Task2 from this program code?

    Attached is the whole program code used in ARM Developer Suite.

    Appreciated and Thanks.
     

    Attached Files:

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-