How many bits is the ADC?
12 digits
How many ADCs are there?
One, two or more to three, depending on the device; each has multiple channels.
About the famous hall of the passage:
10.3.3 Channel Selection
There are 16 multi-channels. The conversion can be divided into two groups: regular and injected. A series of transformations performed in any order on any of a plurality of channels constitutes a group conversion. For example, the conversion can be done in the following order: channel 3, channel 8, channel 2, channel 2, channel 0, channel 2, channel 2, channel 15.
â— The rule group consists of up to 16 conversions. The regular channels and their conversion order are selected in the ADC_SQRx register. The total number of transitions in the rule group is written to the L[3:0] bits of the ADC_SQR1 register.
â— The injection group consists of up to 4 conversions. The injection channels and their conversion order are selected in the ADC_JSQR register. The total number of conversions in the injection group must be written to the L[1:0] bits of the ADC_JSQR register.
What is the difference between them:
l Different groups save the data after conversion, and the generated interrupt flags are different.
l In scan mode, the rule group will be able to pass each channel data to the SRAM through DMA, and the injected group data will always exist in ADC_JDRx.
There are other differences, which are not listed here.
Why ST is so designing AD conversion is definitely a reason, but I don't know, so it is difficult for me to understand the various modes of AD conversion. That is to say, for the understanding of knowledge, it is necessary to put it in the context of its application to learn well. Therefore, the more other knowledge is accumulated, the faster it will be learned. This is the so-called "professional" problem. Someone has a deep foundation, which means that he is well-informed and has many things to encounter, and he can quickly find a "prototype" to handle something. Of course, there are also some people who have a strong abstract learning ability. Even if they can't find a "prototype", he can learn very well. Basically, the scientific literacy of such people is higher, and it is rare among engineers and engineering students.
Gossip less, let's see how to use the AD converter.Take a source program as an example to interpret, and further understand the meaning of the symbols in STM32. I believe that reading the library source program in the future will definitely take it to the next level.
To see more clearly, the following code is represented by a color.
/* ADC1 starts to prepare for configuration*/
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
/*Set ADC-"CR1 19:16 to determine the ADC working mode, there are 10 working modes
#define ADC_Mode_Independent ((uint32_t)0x00000000) 0000: Standalone mode
#define ADC_Mode_RegInjecSimult ((uint32_t)0x00010000) 0001: Mixed Synchronization Rules + Injection Synchronization Mode
#define ADC_Mode_RegSimult_AlterTrig ((uint32_t)0x00020000) 0010: Mixed Synchronization Rules + Alternate Trigger Mode
#define ADC_Mode_InjecSimult_FasTInterl ((uint32_t)0x00030000) 0011: Hybrid Synchronous Injection + Fast Alternate Mode
#define ADC_Mode_InjecSimult_SlowInterl ((uint32_t)0x00040000) 0100: Hybrid Synchronous Injection + Slow Alternate Mode
#define ADC_Mode_InjecSimult ((uint32_t)0x00050000) 0101: Injection sync mode
#define ADC_Mode_RegSimult ((uint32_t)0x00060000) 0110: Rule Synchronization Mode
#define ADC_Mode_FasTInterl ((uint32_t)0x00070000) 0111: Fast Alternating Mode
#define ADC_Mode_SlowInterl ((uint32_t)0x00080000) 1000: Slow Alternate Mode
#define ADC_Mode_AlterTrig ((uint32_t)0x00090000) 1001: Alternate Trigger Mode
*/
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
/* ADC_ScanConvMode is defined in stm32f10x_adc.h as follows:
alState ADC_ScanConvMode;
This parameter is used to specify whether the conversion is a scan (multi-channel mode) or a single conversion (single channel mode). This parameter can be set to DISABLE or ENABLE.
In the data sheet, the SCAN bit is described as follows: Scan mode
This bit is set and cleared by software to turn scan mode on or off. In scan mode, the channel selected by the ADC_SQRx or ADC_JSQRx registers is converted.
0: Turn off scan mode
1: Use scan mode
Note: If the EOCIE or JEOCIE bit is set separately, the EOC or JEOC interrupt will only be generated after the last channel has been converted.
Thus, if you need to convert multiple channels at a time, this must be set to ENABLE.
*/
ADC_InitStructure.ADC_ConTInuousConvMode = ENABLE;
/* alState ADC_ConTInuousConvMode;
This parameter is used to specify whether the conversion is continuous or single, it can be set to ENABLE or DISABLE.
The alState data type appears in these two parameters, so what is it? You can see that it is defined as follows:
Typedef enum {DISABLE = 0, ENABLE = ! DISABLE} alState;
Therefore, it is equivalent to a bit variable, and I understand that DISPABLE=0 has no problem, ENABLE=! Should DISABLE be exactly 1? ? Otherwise the following settings will be a problem.
To use these two symbols to set the bits in the register, you also need to provide location information, as shown in the following code:
Tmpreg1 |= (uint32_t)(ADC_InitStruct-)ADC_DataAlign | ADC_InitStruct-》ADC_ExternalTrigConv |
((uint32_t)ADC_InitStruct-"ADC_ContinuousConvMode "1));
This "1 is position information, CONT is bit 1 of the CON2 register.
In this way, we can see more of the STM32 library.
Used to set the CONT bit of CON2 (bit 1): whether to convert continuously
This bit is set and cleared by the software. If this bit is set, the conversion will continue until the bit is cleared.
Air Glow Pro Vape Pen,Vape Pen Battery Charger,Electronic Cigarettes Kits,Disposable Electronic Cigarettes Kits
Shenzhen Aierbaita Technology Co., Ltd. , https://www.aierbaitavape.com