background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Чтение данных по i2c (часть 1)"

input logo icon
Video tags
|

Video tags

lldevcpu
LLDevCompiler
Assembler
CPU
Programming
Программирование
Процессор с нуля
BMP085
Ассемблер
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:04
everything goes well to show a program
00:00:07
that will read data from the sensor using the
00:00:11
oh tus protocol since the program
00:00:14
turns out to be quite large and at this
00:00:17
stage is not yet completely ready, I decided to
00:00:21
break this story into 2 videos in this
00:00:25
video we Let's look at the main features of
00:00:27
working with the sensor and read
00:00:31
some data from it. As a test subject,
00:00:35
I took the BMP 085 temperature and pressure sensor
00:00:41
to begin with, let's look at
00:00:44
the features of this sensor; perhaps
00:00:47
its main feature is that
00:00:51
when reading temperature or pressure
00:00:54
from the sensor, the sensor returns unrealistic
00:00:58
values ​​and a certain number to which,
00:01:02
in order to obtain real values,
00:01:04
you need to apply calibration coefficients;
00:01:07
these coefficients for each sensor are
00:01:12
stored in certain
00:01:14
registers of the sensor; in fact,
00:01:17
we will read these coefficients in this
00:01:21
video; in the documentation for the BMP
00:01:25
085, the following addresses are indicated; registers in the
00:01:30
calibration;
00:01:31
and this is what the timing diagram looks like
00:01:34
to read data from these registers, this is
00:01:39
what happens here, first of all, the
00:01:43
master device sends a start
00:01:46
signal, these signals are followed by the
00:01:50
write address of the BMP 085 sensor,
00:01:54
if the address is correct, then the sensor will set the
00:01:58
window, press the bit to 0,
00:02:00
then the master device sends the
00:02:04
upper byte the address of the calibration register
00:02:08
data from this register
00:02:12
will subsequently be transferred from the BMP 085
00:02:15
to the master device; for example, the
00:02:20
diagram shows the address 0x f6,
00:02:23
but we will send the upper bytes of the
00:02:26
addresses from the table above, if the sensor
00:02:30
received the correct address, it will again
00:02:33
set the compartment bits to 0,
00:02:37
after which the master must send a
00:02:40
restart signal and then
00:02:44
transmit the address to the party for reading the
00:02:47
BMP 085 sensor,
00:02:50
if the address is correct, then the sensor will set the
00:02:54
compartment bits to zero and begin transmitting the
00:02:57
top byte of data from the
00:03:00
calibration register; when the master accepts this byte,
00:03:04
then the master will have to set the
00:03:07
compartment bits to zero, after which the sensor
00:03:12
will begin transmitting the
00:03:13
bottom byte of data from the
00:03:16
calibration register is where the most
00:03:18
interesting thing begins: after reading this byte, the
00:03:23
master must send the not window,
00:03:27
the bit will be pressed, that is, the vacek offense should be
00:03:30
set to one,
00:03:33
if this is not done, then at an arbitrary
00:03:37
moment when reading the data, the sensor will
00:03:41
report errors
00:03:43
after sending to the master compartment must
00:03:47
send a stop signal at this point the reading of
00:03:50
data from the calibration register will end
00:03:54
before reading the sensor readings
00:03:57
we need to read data from all
00:04:00
11 registers in which the calibration data is stored
00:04:03
now let's look at the code
00:04:07
at the moment I have created 5 files with the
00:04:11
code these are the files main l to l sfc drink ld
00:04:18
hipp aldo al-tusi l yes and bmp 085 ld
00:04:24
file
00:04:26
was before the entry point to the program
00:04:29
and the main loop of the program at the
00:04:33
moment the main function
00:04:35
I call the al-tusi enable function
00:04:39
which includes support and tuse
00:04:41
Vellans chain and the function bmp 085 get
00:04:47
calibration
00:04:48
I want to turn your attention is how the
00:04:51
function call is implemented. At the
00:04:55
moment, the assembly language does not support
00:04:58
calling the mark function, that is, I cannot
00:05:02
write a number of enable in order to
00:05:06
call the function, I must load the mark
00:05:09
into one of the general purpose registers and
00:05:12
apply injection instructions to this
00:05:15
register,
00:05:16
which is actually What I do is load the
00:05:21
oh tus enable label into the
00:05:23
p0 register and call the address located in the
00:05:29
p0 register in the lf file with the
00:05:33
lf circuit and yes, specific
00:05:36
functions for lg will be implemented in all architectures at
00:05:43
the moment there is only one function
00:05:46
to obtain the address of the periphery,
00:05:50
this function is needed because llc everything I drink
00:05:55
they use remapping
00:05:57
for example if the top four bits of the address
00:06:01
are equal to 0 001
00:06:04
this means that we are dealing with RAM
00:06:09
memory if the top four bits of the address
00:06:12
are equal to 0 0 1 0 we are dealing with RAM
00:06:17
memory and if the top four bits of
00:06:21
the address are equal to 0 0 1 1
00:06:25
we we are dealing with peripheral addresses, the
00:06:29
get transfer address function takes one
00:06:33
address parameter without taking into account
00:06:36
memory mapping
00:06:39
and sets the top four bits in this address to
00:06:42
0011, that is, it turns the
00:06:48
abstract address into a peripheral address in the
00:06:51
hip aldo file; functions are implemented to
00:06:56
manage the
00:06:59
hip save heap; it stores the value in the heap by the
00:07:03
specified index value comes
00:07:07
as the first argument of the function
00:07:09
index as the second argument of
00:07:11
the function hip get returns the value from the
00:07:15
heap at the specified yandex yandex
00:07:19
is the only argument of the function
00:07:22
file Oidu Shimada has collected functions for
00:07:26
working with the website using the protocol this function
00:07:30
series of data
00:07:32
accepts data from oh party protocol
00:07:37
function oh tusyat compartment state indicates
00:07:41
what value the window squeeze bit should
00:07:44
be set after receiving data, that
00:07:47
is, whether the compartment or n compartment signal should be poisoned
00:07:51
function al tusi from and
00:07:56
data begin transmitting data about and tusya
00:08:00
protocol function oh tusat
00:08:04
send start signal sends start
00:08:07
signal
00:08:08
function oh tuse son stop signal
00:08:11
sends a stop signal oh tuse enable
00:08:15
enables support and tuse protocol
00:08:19
function oh tuse weight is a
00:08:22
program wait function will not exit this
00:08:26
function until the data is
00:08:28
transmitted or received function oh tuse
00:08:34
eset which la ric val sets
00:08:36
a value in this control register
00:08:40
the only parameter of these functions
00:08:42
is the value that we must
00:08:45
save in the control register
00:08:49
function al-tusi get date
00:08:52
returns the value from oh tus data
00:08:56
input output register function oh tus set
00:08:59
date
00:09:00
sets the value al-tusi data
00:09:03
input
00:09:04
output register function oh tuse get
00:09:10
control rick val returns the value of
00:09:13
al tusi control register function
00:09:17
al tusi get status reg val returns the
00:09:20
value oh tuse register status function
00:09:25
this ciget rick status adr
00:09:27
returns the address and tuse register status
00:09:31
al tusi get date reg adr
00:09:34
address and tuse register date al-tusi get
00:09:39
adr rivers adr returning values ​​al-tusi
00:09:42
register address so far the ldf circuit does not
00:09:46
support working with this register and the
00:09:50
al-tusi function getcount roll rick
00:09:53
adr returns the address oh tusi control
00:09:56
register file bmp 085
00:10:03
aldo collected functions for work with the
00:10:06
BMP 085 sensor, the
00:10:09
BMP 085 get calibration function
00:10:14
requests the value of all
00:10:16
sensor calibration registers and stores these
00:10:19
values ​​in the hip function BMP 085
00:10:28
calibration correct checks whether the calibration value is correct or the
00:10:31
calibration value we have received if all
00:10:36
16 bits of calibration
00:10:38
are equal to zero or all 16 bits of calibration
00:10:41
are equal to one, then the calibration value
00:10:45
incorrect
00:10:51
function BMP 085
00:10:54
cent in Wright adr sends the write address of the
00:10:59
BMP 085 sensor function BMP 085 cent read
00:11:08
adr sends the read address of the
00:11:11
BMP 085 sensor and the BMP 085
00:11:20
and data function sends the data located in
00:11:24
this data input output register to the BMP
00:11:30
085 sensor so that we were able to
00:11:38
see normally how this
00:11:41
program works functions BMP 085
00:11:45
get calibration I set a breakpoint
00:11:50
which looks like this, that
00:11:55
is, it’s just an endless loop, let’s
00:12:01
now compile this program in
00:12:05
order to compile
00:12:07
this code we need to call the
00:12:10
LMDF compiler and pass it
00:12:13
all the files as parameters
00:12:16
dev assembler the first file
00:12:20
must be the file where the
00:12:23
entry point to the program is located
00:12:25
the order of the remaining files is not important
00:12:30
we start the compilation the compilation was
00:12:35
successful now we need to copy the
00:12:41
resulting main hex file to the
00:12:44
llc project everything I drink
00:12:53
I have quartus initializing the rum memory
00:12:56
from the file date. hex
00:12:59
so I need to rename my
00:13:01
. hex to date. fix
00:13:04
now let's check that the calibration of the
00:13:07
sensor is really considered, in order to
00:13:11
check this I connected the BMP 085 with the
00:13:16
lld I drink everything through the breadboard
00:13:19
to which I also connected a logic
00:13:22
analyzer and it will show what is really
00:13:26
happening on the bus of the oh party
00:13:27
and so we compile the llc everything I drink
00:13:42
turn on data analysis on the oh party bus
00:13:46
and load lldp rash pliz
00:13:59
and this is what we see first of all we
00:14:03
send the recording address of the BMP 085 sensor
00:14:08
and get the legend window then we
00:14:12
send the top bit 1 of the calibration register address
00:14:16
and also get a squeeze window
00:14:20
after which we
00:14:22
send the recording address
00:14:24
calibration register again we receive the legend window and
00:14:29
begin to receive calibration data
00:14:32
upper calibration byte 0x 23 and we
00:14:36
send the legend window lower
00:14:41
calibration byte 0x
00:14:42
8f and here we send not the window will start
00:14:49
after which we send the stop signal the complete
00:14:57
package looks like this start
00:15:00
signal restart stop signal
00:15:04
signal
00:15:06
then we start reading the data of the
00:15:08
next address, the calibration register
00:15:11
again sends it to the right address, sends the
00:15:16
top byte of the address of the calibration register,
00:15:19
this time 0x
00:15:20
action, sends the read address of the sensor and
00:15:26
receives the calibration data, and so 11 times the
00:15:34
top byte of the last address of the
00:15:37
calibration register will be 0x
00:15:40
b.u. as you can see, the program
00:15:43
and the processor work; the code from this video
00:15:47
you can find in the examples for the projects
00:15:50
ldf rash and ll girls payer links to
00:15:55
these projects I will leave in the description of the video
00:15:58
in the next video we will look at how to
00:16:01
read temperature measurements from
00:16:04
the sensor and apply calibration data to them
00:16:08
thank you all for watching this video bye

Description:

В прошлый раз я обещал, если все пойдет хорошо, показать программу, которая будет читать данные с датчика по i2c протоколу. Так как программа получается довольно большой, и на данном этапе полностью еще не готова, то я решил разбить данный рассказ на 2 видео. В этом видео мы рассмотрим главные особенности работы с датчиком и прочитаем с него некоторые данные. В качестве подопытного я взял датчик температуры и давления bmp085. Проект lldevcpu: https://github.com/LLDevLab/lldevcpu (branch bmp085_calibration_read, папка code_examples/i2c/bmp085) Проект LLDevCompiler: https://github.com/LLDevLab/LLDevCompiler (branch bmp085_calibration_read, папка examples/i2c/bmp085)

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Чтение данных по i2c (часть 1)" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Чтение данных по i2c (часть 1)" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Чтение данных по i2c (часть 1)" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Чтение данных по i2c (часть 1)" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Чтение данных по i2c (часть 1)"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Чтение данных по i2c (часть 1)"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.