0:20
everyone welcome to controllers tech
0:24
this is the second video in the next ian
0:28
in this video we will see how to send
0:31
some string from the stm32 mcu to the
0:36
let's start with the next ian editor
0:49
i am going to name it strings
0:54
select your display type
1:00
and display orientation
1:12
i am going to add a background picture
1:15
i have few images resized to fit this
1:19
so i will use one of those you can check
1:22
the introduction video
1:24
if you want to know about how to resize
1:28
let's add a picture element to this
1:35
let's resize it i think we need to link
1:38
it to the image first
1:44
so now the entire screen is covered with
1:51
let's add a text field where we will
2:11
note the object name for this field as
2:14
we will use it in our code
2:17
this have the object's name as t0
2:20
the second text file have object name as
2:31
this white background looks weird
2:34
let's make some changes in this
2:38
click style and select cropped image
2:45
now in the pic select the same image
2:48
that you have for the background
2:50
do the same for the second text field
3:04
now let's add the fonts if you already
3:07
fonts you can load them or else generate
3:16
this looks good let's save it
3:24
add the fonts to your project now let's
3:27
change the text color also
3:46
this is all we need for this project
3:48
click save and compile this
3:51
let's debug this project to see how the
3:54
sending and receiving works
3:57
so this is how our final display will
4:01
this here we can send the commands to
4:05
let's send some string to the first
4:09
here t 0 is the object name text is the
4:13
and hello is the string that i want to
4:16
as you see we have the string on the
4:20
also note that there are no spaces in
4:22
between the entire command
4:25
let's see this command in hexadecimal
4:29
here we have t 0 dot t
4:44
this is the command we sent and it is
4:47
followed by zero cross ff
4:58
let's send the string to the object t1
5:15
here you can see the string is again
5:18
0 cross ff so basically
5:22
whenever we send some command to this
5:24
display we need to send this
5:26
3 times 0 cross ff in the end
5:33
let's upload this to the display
5:36
i have my ttl device connected to the
5:40
connect the rx to tx and tx to rx
5:43
as shown in the figure
5:47
click upload select the com port and
5:59
you can see the uploading has begun
6:03
i will fast forward this part
6:14
and there we go we have the new content
6:18
now let's start the cube id
6:40
give some name to this project and click
6:45
let's start our basic setup and enable
6:48
the external crystal for the clock
6:52
select uart so that we can communicate
6:57
make sure that you select the board rate
7:02
it won't work with any other board rate
7:05
these are the tx and rx pins for the
7:10
let's go to the clock setup now i have
7:13
eight megahertz crystal
7:15
and i am running the controller at 72
7:19
click save to generate the project
7:29
let's start the programming part now
7:33
first of all i am creating an array of
7:36
they are 0 cross ff three times
7:41
now let's create a function to send the
7:43
string to the display
7:49
this function will take two parameters
7:53
first is the object name and second is
7:56
the string that we want to send
7:59
now let's create a buffer to store all
8:03
i will use s print f to combine all the
8:07
the format was object name dot text
8:20
now send this buffer via the uart
8:31
and then send the end commands
8:44
now i am going to center low in t0 and
9:00
we got some errors oh this is supposed
9:15
now we have no errors but few warnings
9:19
this one is about s print f so let's
9:21
include the stdio.h file
9:32
i still have one warning and that's
9:34
because i am trying to pass the pointer
9:36
to the character here
9:38
so i will just die cast this
9:48
all looks okay let's debug the code now
10:10
let's run this so we hit the break point
10:15
when i step over this function the
10:17
string got updated in t0
10:23
i will just remove the breakpoint now
10:26
and let it run freely
10:32
let's have a bit more fun with this
10:37
so i will send these set of strings
11:02
and you can see the strings are being
11:04
updated every two seconds
11:10
so we saw how can we send the string to
11:12
the next ian display
11:14
this is it for this video in the next
11:18
i will cover the buttons where we will
11:21
see how to receive data from the display
11:24
whenever a button is pressed and how to
11:28
you can download the related files from
11:31
the description of this video
11:34
keep watching and have a nice day ahead