1
00:00:00,900 --> 00:00:02,230
Hello, welcome back.

2
00:00:02,250 --> 00:00:08,790
In this lesson, we go going to see how to work with defense groups, I'm going to make a copy of one

3
00:00:08,790 --> 00:00:12,620
of our old projects and then I'll just continue from there.

4
00:00:13,460 --> 00:00:19,440
Before that, I'll just clear everything from the screen, OK, so we can select one of our old projects.

5
00:00:20,970 --> 00:00:21,570
Let's see.

6
00:00:23,070 --> 00:00:26,730
I can just select project, which is project number two.

7
00:00:27,510 --> 00:00:31,710
Well, we can just make a copy of the latest one and clean it.

8
00:00:32,950 --> 00:00:36,430
I'll copy this and then paste over here.

9
00:00:38,360 --> 00:00:39,950
I call this events groups.

10
00:00:46,610 --> 00:00:50,390
Scorpion, it's done open this.

11
00:00:54,090 --> 00:00:55,780
This is may not see over here.

12
00:00:56,310 --> 00:01:01,290
I'm going to clean everything we have, all our related code is going to be taken up.

13
00:01:02,570 --> 00:01:07,630
So clean this and in here, I'll clean this as well.

14
00:01:11,680 --> 00:01:19,140
And I explained why we're not creating new projects because we would have to include the the library

15
00:01:19,150 --> 00:01:19,600
files.

16
00:01:20,290 --> 00:01:21,700
OK, so this what we have.

17
00:01:24,410 --> 00:01:31,700
OK, this what we have, so we're going to experiment with different groups, we're going to have two

18
00:01:31,700 --> 00:01:32,270
tasks.

19
00:01:32,450 --> 00:01:37,780
One task would set the event a bit and then the other one would read it.

20
00:01:38,270 --> 00:01:43,090
Before that, we're going to define some bits for the two tasks.

21
00:01:43,430 --> 00:01:44,990
So I'm going to come over here.

22
00:01:47,190 --> 00:01:53,610
Over here, I have to delete these as well or define task one bit as.

23
00:01:55,240 --> 00:02:00,850
It's zero and then task to bit us bit one, this simply means shift.

24
00:02:02,040 --> 00:02:05,940
One, two bits, number zero, shift one to bits, number one.

25
00:02:06,610 --> 00:02:12,930
OK, so once that is done, I'll come over here to create a new task.

26
00:02:15,160 --> 00:02:22,580
Before that, I'm going to I'm going to bring our Ewart's in this program.

27
00:02:22,840 --> 00:02:30,010
We don't have our you out in it, so we are going to transmit the data from you to check our experiment.

28
00:02:30,490 --> 00:02:35,740
So I'll copy our UTX in its function and I'll call it in here.

29
00:02:39,030 --> 00:02:43,440
Okay, and the first and will print this system initializing.

30
00:02:46,530 --> 00:02:50,760
OK, just to make sure our Ewart's good, OK?

31
00:02:50,790 --> 00:02:56,470
And we're going to declare an event group Hando at the top over here.

32
00:02:58,290 --> 00:03:01,590
We're simply calling this X event group once we've declared a handover.

33
00:03:01,630 --> 00:03:07,470
We're going to create the event group and store the handle store.

34
00:03:07,470 --> 00:03:09,950
The handle returned into our handle variable.

35
00:03:10,770 --> 00:03:13,650
Once this is done, we're going to create two tasks.

36
00:03:14,160 --> 00:03:17,610
One is called the Bizet's, the other is called a bit Reede.

37
00:03:18,720 --> 00:03:22,590
They both have the same priority and the same stack size.

38
00:03:23,500 --> 00:03:26,220
OK, and we're going to have the task functions.

39
00:03:26,220 --> 00:03:32,670
This once task function will be called X event setting task and this are the ones task function will

40
00:03:32,670 --> 00:03:35,040
be called X event reading task.

41
00:03:36,020 --> 00:03:40,250
So once we've done this, we simply start our search, the.

42
00:03:42,380 --> 00:03:47,060
And we are familiar with the API already task that Schussler.

43
00:03:48,050 --> 00:03:53,810
So now we have to implement the task functions, the first one event.

44
00:03:55,490 --> 00:04:00,770
Team task going to have this and we're going to have our infinite loop here.

45
00:04:03,680 --> 00:04:09,260
In here, we're going to define a delay amount in milliseconds, we're going to see 500 milliseconds

46
00:04:09,260 --> 00:04:12,230
delay is simply CDMs to takes.

47
00:04:12,890 --> 00:04:16,280
The value returned will be five hundred Emmis.

48
00:04:16,920 --> 00:04:22,520
OK, so we're going to start off by delaying for 500 M is

49
00:04:25,250 --> 00:04:28,760
over here and then we're going to print a message.

50
00:04:29,810 --> 00:04:30,680
We're going to say.

51
00:04:31,760 --> 00:04:37,220
Bit setting task is about to set Bitz zero, so we print this.

52
00:04:39,890 --> 00:04:42,380
And then we go ahead to Cesspits Zero.

53
00:04:43,420 --> 00:04:51,080
By using our function events group, Cesspits, remember, with zero corresponds to task one bit.

54
00:04:51,700 --> 00:04:55,660
So we say event group Cesspits.

55
00:04:56,260 --> 00:05:01,750
We passed the event group Hando here and then the bit we wish to set, which is task one bit bits.

56
00:05:01,750 --> 00:05:02,650
Number zero here.

57
00:05:03,380 --> 00:05:03,880
Okay.

58
00:05:04,820 --> 00:05:14,720
Once that is done, we going to wait a bit, 500 times, and we're going to set for page one as well,

59
00:05:14,720 --> 00:05:16,130
which is task to bit.

60
00:05:18,050 --> 00:05:26,540
OK, so we just see we about to set and then we set about to set and then we said now are we going to

61
00:05:26,540 --> 00:05:29,150
go to the event reader to ask?

62
00:05:31,270 --> 00:05:37,120
A separate task of this task down here, we have the infinite loop.

63
00:05:41,800 --> 00:05:48,820
And over here, we're going to define the bits to wait for currently our system has bits, has to bits.

64
00:05:48,850 --> 00:05:51,640
We have the task one bit and the task to bits.

65
00:05:52,000 --> 00:05:57,600
We can combine the bits using an operation so we define an event.

66
00:05:57,670 --> 00:06:00,700
It's variable here called experts to wait for.

67
00:06:00,910 --> 00:06:03,860
And we have two of them task one bit and task to bits.

68
00:06:04,450 --> 00:06:08,200
So we use an operation to put them together and store them in a single variable.

69
00:06:08,990 --> 00:06:17,390
OK, so now we are going to call X event group, wait for its function to wait for the bids and this

70
00:06:17,390 --> 00:06:18,910
is going to return a value.

71
00:06:19,580 --> 00:06:25,640
So this value that is returned is an event, but we have to start somewhere because of that.

72
00:06:25,670 --> 00:06:33,680
I'm going to create this variable here that would hold the event group value and also I'm going to create

73
00:06:34,790 --> 00:06:35,840
a delay here.

74
00:06:36,970 --> 00:06:39,850
Of two hundred, Miss OK.

75
00:06:43,680 --> 00:06:48,360
So now all we have to do is call our function event group Weetbix.

76
00:06:51,470 --> 00:06:52,670
And this function here.

77
00:06:55,550 --> 00:07:01,430
Takes as its first the event group, Hando, and this is the bits we are waiting for before declared

78
00:07:01,430 --> 00:07:04,690
this, we are waiting for these bits, bits one and bits zero.

79
00:07:05,120 --> 00:07:06,530
OK, and then.

80
00:07:08,870 --> 00:07:16,630
This third argument here is known as the exclosure on exit, and this over here, if we said this to

81
00:07:16,660 --> 00:07:24,620
true, then in a bit setting the value passed over here as bits to wait for will be cleared in the event

82
00:07:24,620 --> 00:07:27,370
group before the event group occurs.

83
00:07:27,470 --> 00:07:30,020
So we want to clear whatever was set.

84
00:07:30,020 --> 00:07:31,000
So we said is true.

85
00:07:31,400 --> 00:07:36,390
This next argument is whether we want to wait for all the bits or not.

86
00:07:36,830 --> 00:07:42,140
So this one, if we said is to true all the bits, is what we are interested.

87
00:07:43,280 --> 00:07:50,120
If we said this to be true, then the event event group, events group, which bits this function would

88
00:07:50,120 --> 00:07:57,710
return when all the bits, when both tossed one bit into two bits are set.

89
00:07:59,820 --> 00:08:05,400
But over here, we are saying false because we don't want all of them, we expect just one of them to

90
00:08:05,400 --> 00:08:05,840
be said.

91
00:08:06,330 --> 00:08:13,020
So if we said is to true, it would wait for all of them, both of them essentially, OK.

92
00:08:13,590 --> 00:08:19,410
So this one here, this and if we want to read more, we can build our project and then go and read

93
00:08:19,410 --> 00:08:20,400
about this function.

94
00:08:20,590 --> 00:08:28,470
OK, even by highlighting that we have it here, the first argument here is the the events group handle.

95
00:08:29,310 --> 00:08:32,760
The second argument is the bits to wait for over here.

96
00:08:32,760 --> 00:08:36,140
We cannot see the rest, but let's double click and see.

97
00:08:36,150 --> 00:08:37,410
Go to declaration.

98
00:08:38,820 --> 00:08:46,920
OK, so the third argument is it's clear on exits, like we said, if we said it's true, then the bits

99
00:08:46,920 --> 00:08:49,350
that were set will be cleared on exit.

100
00:08:50,890 --> 00:08:53,980
What happened was that.

101
00:08:57,000 --> 00:08:58,200
Open declaration.

102
00:08:59,410 --> 00:09:01,690
And then the next one is.

103
00:09:02,790 --> 00:09:08,850
Wait for orbit's whether we want to wait for orbit's or not, we say force and then amount of time to

104
00:09:08,850 --> 00:09:09,160
wait.

105
00:09:09,420 --> 00:09:13,320
And we said CDMs, we said Portsmouth's delay, OK?

106
00:09:15,550 --> 00:09:23,010
So once that is done, we just continue, we find out which bits is set, so we say in any of the bits.

107
00:09:23,320 --> 00:09:28,840
So since that's the case, then we have to use and if block to find out which of it.

108
00:09:29,500 --> 00:09:36,710
So we're going to take the the retained value X group value here and perform on an operation.

109
00:09:37,540 --> 00:09:41,610
So we're going to take this perform on an operation with task one bit.

110
00:09:42,400 --> 00:09:49,330
If this is not equal to zero, meaning if it is if it is one, then we say bits reading task events,

111
00:09:49,330 --> 00:09:51,730
bits zero is what we've just read.

112
00:09:52,060 --> 00:09:53,770
Cos, you know, this is for task one.

113
00:09:59,800 --> 00:10:01,290
I can put task one here.

114
00:10:03,670 --> 00:10:10,480
Because the tasks have different, you know, numbers compared to the bits, so then we can do the same

115
00:10:10,480 --> 00:10:13,630
thing for me to perform the same operation here.

116
00:10:15,700 --> 00:10:18,610
Four bits, one story, which is four task to.

117
00:10:24,290 --> 00:10:29,080
And then we can delay a bit, we can delay our 200 Emmis, OK?

118
00:10:31,150 --> 00:10:36,550
So this is it now we're going to put the function prototypes out of TOPIA.

119
00:10:49,460 --> 00:10:52,100
Okay, now let's build and see.

120
00:10:54,940 --> 00:10:56,110
Click over here to build.

121
00:11:01,250 --> 00:11:07,660
OK, the reason we get to this is we have to include events, group storage, because it's a new component

122
00:11:07,660 --> 00:11:08,380
to want to use.

123
00:11:09,080 --> 00:11:13,190
I'll come over here or Simms's was not open declaration.

124
00:11:16,400 --> 00:11:20,450
And that we include events groups today over here.

125
00:11:22,090 --> 00:11:23,530
No, I'll click and build.

126
00:11:29,540 --> 00:11:30,850
It's built successfully.

127
00:11:32,750 --> 00:11:33,890
Right, click over here.

128
00:11:35,530 --> 00:11:38,650
See the bug US ASTM 32.

129
00:11:40,290 --> 00:11:43,410
And then I'll click on events groups over here.

130
00:11:46,980 --> 00:11:48,120
And then I'll say, OK.

131
00:11:56,240 --> 00:11:57,350
And I'll click the switch.

132
00:12:05,420 --> 00:12:14,210
Then I'll come over here to view our real time and then I'll click to run over here.

133
00:12:14,870 --> 00:12:15,530
You can see.

134
00:12:16,490 --> 00:12:19,520
We are and reading the events bit so over here.

135
00:12:21,580 --> 00:12:23,050
So bit in task.

136
00:12:23,930 --> 00:12:29,000
About two, said Spitz, one, and then bits reading task events, bits one set.

137
00:12:30,960 --> 00:12:37,140
Which is for task two and then with a certain task about to set with zero, which reading task event

138
00:12:37,560 --> 00:12:40,240
but zero set, which is for task one.

139
00:12:40,590 --> 00:12:46,140
So this is a simple experiment just to show us how to set event bits and how to read them.

140
00:12:46,530 --> 00:12:50,260
OK, so this is our basic event bit introduction.

141
00:12:51,000 --> 00:12:53,160
This order is I'll see you in the next lesson.
