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);
}
} |