当前位置:网站首页>Peripherals: ADC
Peripherals: ADC
2022-07-21 07:14:00 【Luxi Feixi】
ADC The introduction of
What is? ADC
(1)ADC:analog digital converter,AD transformation , A / D conversion ( That is, analog to digital )
(2)CPU Itself is digital , And the external world variables ( Such as voltage 、 temperature 、 Height 、 pressure ···) It's all simulated , So we need to use CPU To deal with these external analog variables, you need to do AD transformation .Why ADC
(1) In order to use digital technology to deal with external analog physical quantities .About analog quantity and digital quantity
(1) What is simulated is continuous , Time in real life 、 voltage 、 Height, etc. are simulated ( Continuously distributed , The division can be infinitely smaller ). Analog quantity reflected in mathematics is infinite decimal places ( from 0 To 1 There are countless numbers between )
(2) Digital is discrete , Offline is discontinuous . This discrete processing is actually a mathematical description of the analog quantity in reality with limited accuracy . Digitalization is discretization , That is to take points of continuously distributed analog quantity according to a certain accuracy ( sampling ) Become a numerical value of a finite number of discontinuous distributions , It is called digital quantity .
(3) The significance of digitalization is that it can be used ( discrete ) Mathematics to simplify the description of analog quantity , This thing is the foundation of computer technology .
(4) Computer processing parameters are all digital , Computers need digitized values to participate in operations . If there is analog quantity in the system input parameters , You need to add AD The converter converts analog quantity into digital quantity and then gives it to the computer .Yes AD Naturally there is DA
(1)AD yes analog to digital,DA Nature is digital to analog, Digital to analog .
(2) Pure use cpu It is impossible to convert digital to analog , because cpu Itself is digital . The use of some ( Having some integral or differential effects ) Physical devices can realize digital to analog .
(3) The role of digital to analog . For example, it can be used as a waveform generator .
ADC The main related concepts
range ( Analog input range )
(1)AD The converter is an electronic device , So he can only input voltage signal . Other kinds of analog signals need to pass through the sensor first (Sensor) The conversion of into an analog voltage signal can then be given AD.
(2)AD The analog voltage at the input requires a range , It's usually 0~3.3V or 0~5V Or is it 0~12V wait . The range of analog voltage is AD A parameter of the chip itself . Give... In actual work AD The voltage signal must not exceed this voltage range .precision ( The resolution of the resolution)
(1)AD The digital value of the conversion output has a certain number of digits ( for example 10 position , It means that the digital value output is in 10 Expressed in binary digits , This is called 10 position AD). This digit represents the conversion accuracy .
(2)10 position AD It's equivalent to dividing the whole range into 1024 Lattice , The interval between each grid is the representation accuracy of voltage . Join in AD The range of the chip is 0~3.3V, Then the voltage value represented by each grid is 3.3V/1024=0.0032265V. If at this time AD The digital quantity after conversion is 447, Then the analog value represented by this digital quantity is :447×0.0032265V=1.44V.
(3)AD The more digits , Then the smaller the voltage value represented by each grid , The more accurate the analog voltage value calculated in the future .
(4)AD With the same analog range ,AD The more precision digits, the higher precision , The more accurate the measured value . But if AD The measuring range is different . for example 2 individual AD,A The measuring range is 0~50V,B The measuring range is 0~0.5V,A yes 12 Bit ,B yes 10 Bit , Probably B It's more accurate than A Even higher .(A The accuracy of the :50/1024=0.04883,B The accuracy of the :0.5/4096=0.000122)Conversion rate (MSPS And conventor clock Different )
(1) First of all, understand :AD The chip performs AD Conversion takes time . How long does it take , Different chips are different , The configuration of the same chip is different ( For example, the accuracy configuration is 10 The bit time ratio accuracy is configured as 12 Be small when you are in position , For example, some AD Can be equipped with conversion clock , If the clock frequency is high, the conversion time is short ) Time conversion time is also different .
(2) Please refer to the data manual for details of the time required . The unit used to describe the conversion rate in the general data manual is MSPS( first M It's a sign ,S yes sample, It's sampling ;PS Namely per second, The total meaning is megasamples per second , How many plants turn out per second M A numeric value )
(3)AD Work requires a clock , This clock has a range , When we actually configure it, just don't exceed this range .AD The conversion is carried out under this clock , The frequency of the clock controls AD The rate of conversion . Be careful : Clock frequency and MSPS It's not the same thing , Just proportional is not exactly equal . for example S5PV210 Medium AD converter ,MSPS = clock frequency /5The channel number
(1)AD How many ways does the chip have analog input passageway , It represents how many analog signals can be input simultaneously in the future .
S5PV210 Of ADC
ADC and ( Resistive ) The relationship between touch screen
(1)ADC stay 210 Of the data book Section10.7
(2) The resistive touch screen itself depends on AD transformation , So in 210 Of SoC The medium resistance touch screen interface itself and ADC The interface is one . Or the resistive touch screen interface uses ( Reuse the )ADC The interface of .ADC Working clock block diagram
(1)ADCCLK yes ADC The clock that the controller works , That is to say 1.13.2.3 Section conventor clock. It can be seen from the clock block diagram , It is PCLK( Certainly PCLK_PSYS) After a frequency division . So initialize in the future ADC There must be a step for the controller to initialize the frequency divider here .210 Of 10 individual ADC passageway ( Be careful ADC Pins and GPIO The difference between )
(1)210 Total support 10 individual ADC passageway , Respectively called AIN[0]~AIN[9]. Theoretically, it can be done at the same time 10 road AD transformation .
(2)SoC The pin of at least points 2 Kind of :digit Digital pins and analog Analog pin . We used to contact GPIO All belong to digital pins ,ADC channel Channel pins belong to analog pins . Generally, digital pins and analog pins cannot be mixed .ADC The main register of the controller
TSADCCON0
TSDATX0 TSDATY0 It turned out to be AD Values exist here , We also read here
CLRINTADC0 Clearing and interrupting
ADCMUX Select the currently operating AD passageway
(1) There are ways to wait for the touch screen to complete the conversion 2 Kind of : One is to check the flag bit , The second is interruption . In the first way, we start a conversion first, and then check the flag bit repeatedly until the flag bit is 1 It indicates that you can read after conversion ; The second way is to set the interrupt , Write interrupt isr To read AD Conversion data . Then turn on the interrupt CPU Don't worry about it , etc. AD After the conversion, an interrupt signal will be generated to CPU, It will enter the interrupt processing process . The first method is synchronous , The second way is asynchronous .
(2)AD All transformations need to be repeated , After one turn, it is generally necessary to start the next conversion immediately , Therefore, there needs to be a mechanism that can automatically start the next time after one turn . This mechanism is called start by read, The working method of this mechanism is : When we read this AD The conversion AD After value , The hardware automatically turns on next time AD transformation .
AD Programming practice of transformation 1
AD Controller initialization
Cycle are AD sampling
AD Programming practice of transformation 2
Compile, run, debug
start by read Model is introduced
(1) Application method : Turn on start by read Pattern , Read it for the first time and lose it , This reading can start the next AD transformation , Then you can keep reading AD The value of .DAC Application introduction of
边栏推荐
猜你喜欢
Moco V2: further upgrade of Moco series
【Flutter -- 基础组件】按钮组件 - ElevatedButton、TextButton、OutlinedButton、IconButton
外设篇:NandFlash和iNand
C陷阱与缺陷 第2章 语法“陷阱” 2.5 函数调用
C陷阱与缺陷 第1章 词法“陷阱” 1.5 字符与字符串
Start to build a three node Eureka cluster
iptables :chains, target
[shutter -- layout] basic use of container
TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
Web3 社交赛道的新变化:向族群化、场景化转变
随机推荐
MySQL 啥时候用表锁,啥时候用行锁?
【Flutter -- 基础组件】AppBar 的使用
Jackson dynamically filters attributes, and programmatically filters attributes in objects
全球位置编号GLN申请攻略
(note) CIE chromaticity diagram
动手搭建一个三个节点的eureka集群
2022年7月8日
Wallys/DR882/QCA9882/ AC/AN MiniPCIE/2 × 2.4GHz 2x5GHz MT7915 MT7975
抽丝剥茧C语言(高阶)文件操作+练习
开放科学背景下的科学数据开放共享:国家青藏高原科学数据中心的实践
[C language] bubble sort upgraded version --- applicable to any type
【线性DP】数字三角形
How to download video files
动作活体检测能力,构建安全可靠的支付级“刷脸”体验
国内外知名源码商城系统盘点
Deit: attention can also be distilled
[shutter -- layout] basic use of container
【Ping检测】使用Ping命令检查网络连接情况
外设篇:I2C通信详解
New changes in Web3 social track: change to ethnic and situational