1
00:00:01,900 --> 00:00:02,360
Hello.

2
00:00:02,410 --> 00:00:03,250
Welcome back.

3
00:00:03,250 --> 00:00:10,650
So in this section we're going to look at how to generate standard general purpose input output firmware

4
00:00:10,660 --> 00:00:15,090
code using the SDM that's to cube emacs in this very first lesson.

5
00:00:15,100 --> 00:00:19,790
We're going to generate code to give us a simple input output effect.

6
00:00:19,810 --> 00:00:26,140
We're going to initialize an input pin and then an output pin and then you're going to see how easy

7
00:00:26,170 --> 00:00:29,200
and how very straightforward it is.

8
00:00:29,200 --> 00:00:32,750
Before we do that let's take our particular board.

9
00:00:32,770 --> 00:00:35,460
I'm using the SDM 32 F4 disco board.

10
00:00:35,470 --> 00:00:42,140
So what I want is I want to take a look at the user guide and see where my my user button is connected.

11
00:00:42,250 --> 00:00:46,380
My Disco Ball comes with one use a button and for ladies.

12
00:00:46,390 --> 00:00:49,470
So I want to know which particular GPA your pins.

13
00:00:49,510 --> 00:00:55,510
These are connected so I can just generate that initiation code for such pins.

14
00:00:55,570 --> 00:01:00,350
To do that I'm just going to search the name of my disco board.

15
00:01:00,580 --> 00:01:02,320
I'm going to search it on Google.

16
00:01:02,590 --> 00:01:05,740
So you search this on Google the name of your board.

17
00:01:05,980 --> 00:01:11,950
Plus the word user manual and you find a link to the PDA file and then once you do that you can just

18
00:01:11,950 --> 00:01:14,370
scroll down to this schematic diagram.

19
00:01:14,410 --> 00:01:27,340
I'm just going to come down here and I should see a schematic somewhere yes OK I just assume in and

20
00:01:27,400 --> 00:01:36,940
as we can see over here my L.D. I've got my got my green LG connected to PD twelve my orange connected

21
00:01:36,940 --> 00:01:41,620
to PD 13 the red to 14 and the blue to 15.

22
00:01:41,640 --> 00:01:44,440
So I know these are the LCD pins.

23
00:01:44,500 --> 00:01:48,520
Next let's see where my use a button is connected.

24
00:01:48,640 --> 00:01:49,650
Let's see.

25
00:01:49,720 --> 00:01:54,310
So here it is says user in Wake Up button so we can use.

26
00:01:54,310 --> 00:01:59,670
They use a button as a wake up button as well and it's connected to a zero.

27
00:01:59,680 --> 00:02:07,780
So what we want is to go to Cuba next and enable P is you as a digital input and then enable one LCD

28
00:02:07,800 --> 00:02:08,870
over here.

29
00:02:08,890 --> 00:02:14,780
How about we use the orange which is which is PD 13 as a digital output.

30
00:02:14,800 --> 00:02:16,510
And then we just generate code for that.

31
00:02:16,540 --> 00:02:22,210
So let's head to Cuba Amex and demonstrate the I've just opened my Cuban Amex from here and I'm going

32
00:02:22,210 --> 00:02:24,920
to create a new project.

33
00:02:24,940 --> 00:02:27,950
And of course you will bring me here.

34
00:02:28,060 --> 00:02:35,470
And what I want is to select my board our youth sports selector over here and I want a discovery board

35
00:02:35,630 --> 00:02:44,230
so that discovery over here my MCU is the SDM 32 F for MCU and the particular microcontroller version

36
00:02:44,230 --> 00:02:54,080
is the 4 1 1 e so select this and then I'll double click and I'll just expand here like this and it

37
00:02:54,080 --> 00:02:54,990
gives the pin out.

38
00:02:55,010 --> 00:02:55,820
Yes.

39
00:02:55,820 --> 00:02:59,850
So first step what we want to do is to disable the forward to pin out.

40
00:02:59,870 --> 00:03:02,460
It's provided us so I'll come over here.

41
00:03:02,600 --> 00:03:08,340
Pin out like this and it would ask me and then I'll confirm by clicking yes.

42
00:03:08,510 --> 00:03:16,220
Once that is done we said why are our button is connected to a zero and we want to use the orange LCD

43
00:03:16,250 --> 00:03:24,360
which is connected to PD 13 so I can just come over here click this and then set it aside GPI outputs

44
00:03:24,420 --> 00:03:27,850
like this and p zero.

45
00:03:27,900 --> 00:03:35,890
Whereas PSU we can search PSU here p zero and here it is I can click this and set it to a cheap I O

46
00:03:35,950 --> 00:03:44,890
inputs and I can rename this label like we learned by right click and enter and I just call this orange

47
00:03:47,190 --> 00:03:56,230
and I call rename this also by right clicking and to use a label and I'll call it button like this.

48
00:03:56,980 --> 00:04:03,670
So once this is done we want to come to clock configuration and we can keep the default system clock

49
00:04:03,700 --> 00:04:07,030
which is ninety six megahertz that's good.

50
00:04:07,030 --> 00:04:15,730
And actually we have to set the debugger we have to set this as y s the system settings we have to choose

51
00:04:16,210 --> 00:04:23,150
otherwise we wouldn't be able to program our microcontroller board and so I'm going to choose the serial

52
00:04:23,150 --> 00:04:28,670
wire that's what the disco board comes with our select 0 wire here and of course in the data sheet we

53
00:04:28,670 --> 00:04:33,880
realize the p A's euro can be used as a use a button or as a wake up button.

54
00:04:34,190 --> 00:04:39,920
So because we use it as a use a button we've caught a red market indicate and there is a conflict we

55
00:04:39,920 --> 00:04:45,380
cannot use it as a wake up button but we do not need a wake up button anyway so that is fine.

56
00:04:45,380 --> 00:04:51,890
So I just come to configuration and we don't need to configure anything for this project and I'll come

57
00:04:51,890 --> 00:05:00,620
to generation I'll click over her project folder choose this folder and project name or call it input

58
00:05:00,680 --> 00:05:15,410
output imposed on the school output and coach generation on leave all of this the same and I select

59
00:05:15,410 --> 00:05:18,790
my my to change which is the.

60
00:05:18,860 --> 00:05:24,920
The five I select this and once that is done I just click okay to generate the code

61
00:05:27,680 --> 00:05:34,170
and I just open the project open the project straight up and later on I can come in.

62
00:05:34,170 --> 00:05:38,600
Click here to generate a report for my or my particular project.

63
00:05:38,610 --> 00:05:41,160
So let's see it's generated.

64
00:05:41,160 --> 00:05:51,440
We can open here to inspect the main file and here we are it's generated although we need it's initialize

65
00:05:51,440 --> 00:05:59,120
the GPL use and we can expected by double click and right click go to definition and before we get everything

66
00:05:59,120 --> 00:06:01,430
to link up we have to reduce the project.

67
00:06:01,490 --> 00:06:02,810
So I'll just rebuilt this

68
00:06:06,860 --> 00:06:12,840
and it's finished rebuild and now I can right click and go to definition and let's see how it's initialized.

69
00:06:12,860 --> 00:06:14,540
It's initialized GPA you a.

70
00:06:14,540 --> 00:06:16,970
This is where our pattern is connected.

71
00:06:16,970 --> 00:06:24,230
It's initialized GPA D as well where our lady is connected and this the initialization sequence.

72
00:06:24,230 --> 00:06:30,620
Those of you familiar with program in the SDM 32 hardware abstraction layer this looks very familiar

73
00:06:30,620 --> 00:06:31,650
to you.

74
00:06:31,940 --> 00:06:38,870
So the label we gave it's orange it's it's said the label name here us orange pin and the other label

75
00:06:38,870 --> 00:06:42,170
we give the button nice button is said to her as a button pin.

76
00:06:42,170 --> 00:06:47,100
So without much ado I would just go ahead and beating around the bush.

77
00:06:47,120 --> 00:06:49,210
Let's just demonstrate.

78
00:06:49,460 --> 00:06:56,700
So what we want is to read the button and then write the value of the button to the LCD.

79
00:06:57,360 --> 00:07:00,340
What I'm going to do is I'm going to go inside my main file.

80
00:07:00,350 --> 00:07:07,130
My main function to do this of course initialization here and what I want is if I'm not very familiar

81
00:07:07,130 --> 00:07:12,530
with the API is to use at this stage I can always click functions over here and select the particular

82
00:07:12,530 --> 00:07:15,940
module I'm looking for which is the key API module.

83
00:07:16,370 --> 00:07:21,770
And once I click here it gives me the list of functions and that's the function I want I want the whole

84
00:07:21,800 --> 00:07:23,920
GPI or read pin.

85
00:07:23,930 --> 00:07:25,670
This will allow me to read a pen.

86
00:07:25,790 --> 00:07:30,860
So if I want to see more about this I can double click this function and then it tells me about this

87
00:07:30,860 --> 00:07:31,310
function.

88
00:07:31,310 --> 00:07:35,930
This function takes two arguments the port and then the PIN number.

89
00:07:35,930 --> 00:07:42,750
So in fact if I don't want to type it all I can just copy this function over here and come to Main and

90
00:07:42,810 --> 00:07:47,980
then paste it and the pin I want to read is and GPI you GPI.

91
00:07:48,010 --> 00:07:49,130
Okay.

92
00:07:49,510 --> 00:08:03,610
And it pins zero P I O pin zero like this so I can read this and this and this function returns a parameter

93
00:08:03,680 --> 00:08:06,760
returns the port pin value the value of the pin.

94
00:08:06,820 --> 00:08:14,710
So it's returns it as 0 or 1 0 means the penis or President 1 means it is pressed so I could just come

95
00:08:14,710 --> 00:08:19,360
here and say declare new variable here.

96
00:08:19,400 --> 00:08:33,810
You in 32 button status in 32 underscore t you in third to underscore t button status and I could I

97
00:08:33,810 --> 00:08:37,800
can come down here and see a button status a course this

98
00:08:42,420 --> 00:08:51,540
and what I want is I can just write the value of button status to the to the LCD I could just come here

99
00:08:51,690 --> 00:09:02,580
and see how GPI your right pin all on the school GPA you score right Ben and this one also takes the

100
00:09:02,580 --> 00:09:11,730
port's name GPA D and then a pin number GPA I could just say orange pin because of the label we used

101
00:09:12,750 --> 00:09:21,480
Yeah we could have used button pin and then I can just see buttons state status like this just to demonstrate

102
00:09:22,040 --> 00:09:28,620
I I'll just call this button pin here like this and you can see the useful ness of the label here.

103
00:09:28,640 --> 00:09:29,750
So now it's all set.

104
00:09:29,750 --> 00:09:36,460
Well we have to do this with Dillard and then download onto our board and I'll just rebuild from her

105
00:09:38,270 --> 00:09:45,080
and we can verify the box settings here as you can see debugger is the SD link debugger using the serial

106
00:09:45,080 --> 00:09:48,470
wire and we can verify that from her.

107
00:09:48,500 --> 00:09:53,510
I just want to reset and run so I don't need to press the reset button to see the changes take effect

108
00:09:53,540 --> 00:10:01,430
so I'll take this over here and click okay and click okay and I reviewed my project and then I download

109
00:10:01,430 --> 00:10:08,630
onto my board and it's finished downloading it's running now and I can see as I press the button the

110
00:10:08,650 --> 00:10:10,180
light turns on.

111
00:10:10,180 --> 00:10:16,870
So this is very simple in fact if you've never program an SDM 32 board before just by using the Cuban

112
00:10:16,870 --> 00:10:22,030
mix you can get this to work in less than two minutes basically.

113
00:10:22,120 --> 00:10:27,660
So let's move on and see the other application I'll see in the next lesson.
