samples/drivers/adc/adc_sequence/README.html · samples/drivers/adc/adc_sequence/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Drivers · ADC

ADC Sequence Sample

Sequence specification에 따라 여러 ADC sample을 묶어서 수집합니다.

Official pathsamples/drivers/adc/adc_sequence/README.html
Source filesamples/drivers/adc/adc_sequence/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

두 channel, 각 5개 sample의 연속 측정과 devicetree 조건을 보존합니다.

Channels

2

Read call

1 sequence

Samples

5 per channel

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 14F7162113DB6A242E3EA9AB3D7B7C94B27FF96ADA2A9AECA90BD6F5E1E08706
.. zephyr:code-sample:: adc_sequence
   :name: Analog-to-Digital Converter (ADC) sequence sample
   :relevant-api: adc_interface

   Read analog inputs from ADC channels, using a sequence.

Overview
********

This sample demonstrates how to use the :ref:`ADC driver API <adc_api>` using sequences.

Depending on the target board, it reads ADC samples from two channels
and prints the readings on the console, based on the sequence specifications.
Notice how for the whole sequence reading, only one call to the :c:func:`adc_read` API is made.
If voltage of the used reference can be obtained, the raw readings are converted to millivolts.

This example constructs an adc device and setups its channels, according to the
given devicetree configuration.

Building and Running
********************

Make sure that the ADC is enabled (``status = "okay";``) and has each channel as a
child node, with your desired settings like gain, reference, or acquisition time and
oversampling setting (if used). It is also needed to provide an alias ``adc0`` for the
desired adc. See :zephyr_file:`boards/nrf52840dk_nrf52840.overlay
<samples/drivers/adc/adc_dt/boards/nrf52840dk_nrf52840.overlay>` for an example of
such setup.

Building and Running for Nordic nRF52840
========================================

The sample can be built and executed for the
:ref:`nrf52840dk_nrf52840` as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/adc/adc_sequence
   :board: nrf52840dk/nrf52840
   :goals: build flash
   :compact:

To build for another board, change "nrf52840dk/nrf52840" above to that board's name
and provide a corresponding devicetree overlay.

Sample output
=============

You should get a similar output as below, repeated every second:

.. code-block:: console

   ADC sequence reading [1]:
   - ADC_0, channel 0, 5 sequence samples:
   - - 36 = 65mV
   - - 35 = 63mV
   - - 36 = 65mV
   - - 35 = 63mV
   - - 36 = 65mV
   - ADC_0, channel 1, 5 sequence samples:
   - - 0 = 0mV
   - - 0 = 0mV
   - - 1 = 1mV
   - - 0 = 0mV
   - - 1 = 1mV

.. note:: If the ADC is not supported, the output will be an error message.

Part 3

한국어 전문 번역

개요

이 sample은 sequence를 사용해 ADC driver API를 이용하는 방법을 보여줍니다.

대상 board에 따라 두 channel에서 ADC sample을 읽고, sequence specification에 근거한 측정값을 console에 출력합니다. 전체 sequence를 읽을 때 adc_read() API를 단 한 번만 호출한다는 점에 유의하십시오. 사용한 reference의 voltage를 구할 수 있으면 raw reading을 millivolt로 변환합니다.

이 예제는 주어진 devicetree 구성에 따라 ADC device를 만들고 channel을 설정합니다.

Build와 실행

ADC가 활성화되어 있는지, 즉 status = "okay";인지 확인하십시오. 각 channel은 ADC의 child node여야 하며 원하는 gain, reference, acquisition time, 그리고 사용하는 경우 oversampling 설정을 포함해야 합니다. 원하는 ADC에는 adc0 alias도 제공해야 합니다. 구성 예는 samples/drivers/adc/adc_dt/boards/nrf52840dk_nrf52840.overlay를 참조하십시오.

Nordic nRF52840용 Build와 실행

nrf52840dk/nrf52840 board에서는 다음과 같이 sample을 build하고 실행할 수 있습니다.

west build -b nrf52840dk/nrf52840 samples/drivers/adc/adc_sequence
west flash

다른 board용으로 build하려면 위의 nrf52840dk/nrf52840를 해당 board 이름으로 바꾸고, 그 board에 맞는 devicetree overlay를 제공하십시오.

Sample 출력

아래와 비슷한 출력이 1초마다 반복되어야 합니다.

ADC sequence reading [1]:
- ADC_0, channel 0, 5 sequence samples:
- - 36 = 65mV
- - 35 = 63mV
- - 36 = 65mV
- - 35 = 63mV
- - 36 = 65mV
- ADC_0, channel 1, 5 sequence samples:
- - 0 = 0mV
- - 0 = 0mV
- - 1 = 1mV
- - 0 = 0mV
- - 1 = 1mV

참고: ADC가 지원되지 않으면 오류 message가 출력됩니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.