Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use ADC

Shulou Source: shulou.com Published: 2022-06-01 03:59:24 10月15日 Update

This article mainly introduces "how to use ADC". In daily operation, I believe many people have doubts about how to use ADC. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use ADC". Next, please follow the editor to study!

1. Preface

Abbreviation for ADC,Analog-to-DigitalConverter, finger / digital converter or analog-to-digital converter [1]. It refers to the device that converts continuously changing analog signals into discrete digital signals. Real-world analog signals, such as temperature, pressure, sound or images, need to be converted into digital forms that are easier to store, process, and transmit.

The corresponding DAC,Digital-to-AnalogConverter is the reverse process of ADC analog-to-digital conversion.

ADC is widely used in the development of single-chip microcomputer. This article is the first in a series of ADC articles to get to know the application of ADC in TPYBoard.

2.TPYBoard support for ADC

TPYBoard comes with 12 ADC pins, which are:

X11,X12,Y11,Y12,X1,X2,X3,X4,X5,X6,X7,X8 .

The use of STM32 chip ADC with a precision of 16 bits can fully support the general requirements of ADC use

The output data of ADC is 0-4095, which is a digital analog signal. All kinds of data can be restored by calculation.

3. Required equipment

TPYBoard10X together

A data line

Serial debugging tool

4. Effect display

Figure 1: using the Y11ADC foot to get the output data is about 800. the picture shows using Putty to print the serial port data.

Figure 2: press the Y11 pin with your finger and release (the effect is shown in figure 3)

Figure 3:

5. Code

# main.py-- put your code hereafter import pybadc = pyb.ADC (pyb.Pin ('Y11')) while True: pyb.delay (1000) val = adc.read () print (val) this ends the study of "how to use ADC", hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Data signal learning serial port effect digital article more analog-to-digital converter process help support output utility next number code preface single chip microcomputer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Linux MariaDB Redmi