Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help in rtos embedded systems

Status
Not open for further replies.

dhivyadurga

Newbie level 6
Joined
Jul 28, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,395
hai everybody,...
we run the program for lcd display using uCOS-II in lpc2148 arm7 kit. we created 3 tasks which are having different priorities. Depending upon the priority the 3 tasks are running,... but it runs only one time. we want to run the tasks continuously. that is, after the completion of third task the control should go to the first task and run depends on the priority,... what is the problem in our code???
if anyone know, pls send us reply......

our code is given below..
thank you..


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
void main()
{
  BSP_IntDisAll();
  OSInit();
  
  
  OSTaskCreate(Task1, 0, &Task1stk[99], 1);
 
  OSTaskCreate(Task2, 0, &Task2stk[99], 3); 
 
  OSTaskCreate(Task3, 0, &Task3stk[99], 2);
 
  //OSTaskCreateExt (Task1,0,&Task1stk[99],1,100,0,100,0,0x0000u);
  SemA=OSSemCreate(1);
  //SemB=OSSemCreate(1);
   OSStart();
 }
 
 
void Task1(void *pdata)
{
   lcd_init();  
   auto OS_TCB data;
   auto INT8U  err;
   OSTaskQuery(OS_PRIO_SELF, &data);
   
   while(1)
   {
    OSSemPend(SemA, 1, &err);
    lcd_write_control(0x01);                            // Clear Display  (Clear Display,Set DD RAM Address=0) 
    goto_cursor(0x00);                                  // Set Cursor Line-1
    lcd_print("LCDDEMOPRGM");                                                       // Display LCD Line-1   
    OSSemPost(SemA);
    OSTimeDlyHMSM(0,0,0,100);
   }
}
 
 
 
void Task2(void *pdata)
{
   lcd_init();      
   auto OS_TCB data;
   auto INT8U  err;
   OSTaskQuery(OS_PRIO_SELF, &data);
   
  while(1)
  {
    OSSemPend(SemA, 0, &err);
    lcd_write_control(0x01);                            // Clear Display  (Clear Display,Set DD RAM Address=0) 
    goto_cursor1(0X00);                                 // Set Cursor Line-1
    lcd_print("SUCCESS ");                  // Display LCD Line-1  
    OSSemPost(SemA);
    OSTimeDlyHMSM(0,0,0,100);
  }
}
 
void Task3(void *pdata)
{
 
  lcd_init();   // Initial LCD
  auto OS_TCB data;
   auto INT8U  err;
   OSTaskQuery(OS_PRIO_SELF, &data);
   
  while(1)
  {
    OSSemPend(SemA, 0, &err);
    lcd_write_control(0x01);                            // Clear Display  (Clear Display,Set DD RAM Address=0) 
    goto_cursor(0x00);                                  // Set Cursor Line-1
    lcd_print("TASK3 executed now");
    OSSemPost(SemA);
    OSTimeDlyHMSM(0,0,0,100);
 }
}

 
Last edited by a moderator:

Greetings,

At first glance I already see a possible problem. I believe that uC/OS-II reserves the three highest and three lowest priorities for system tasks. I would try making your tasks priorities 4, 5, and 6, respectively.

-Willis
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top