```SIOC

MIAT實驗室

WU-YANG
Technology Co., Ltd.

Digital)進行訊號轉換，並使讀者瞭解：

2
Introduction
3
 資料保存(sampling and Holding)
 取樣率(Sample rate)越高則訊號越不易失真
 量化(Quantization)
 量化的位元數越高則解析度越高
4














12-bit resolution
Interrupt generation at End of Conversion, End of Injected
conversion and Analog watchdog event
Single and continuous conversion modes
Scan mode for automatic conversion of channel 0 to channel ‘n’
Self-calibration
Data alignment with in-built data coherency
Channel by channel programmable sampling time
External trigger option for both regular and injected conversion
Discontinuous mode
Dual mode (on devices with 2 ADCs or more)
STM32F103xx performance line devices: 1 µs at 56 MHz (1.17
µs at 72 MHz)
ADC supply requirement: 2.4 V to 3.6 V
ADC input range: VREF- <= VIN <= VREF+
DMA request generation during regular channel conversion
5
6
7
8
 Regular channels(規則通道):

 Injected channels(注入通道):

 當程序正在執行的時候，中斷是用來打斷你的

9
 regular group
10
 injected group
11
Analog watchdog
12
Time diagram
13
Conversion mode





Single conversion mode
Continuous conversion mode
Scan mode
Discontinuous mode
14
Discontinuous mode

Regular group
Example:
n = 3, channels to be converted = 0, 1, 2, 3, 6, 7, 9, 10
1st trigger: sequence converted 0, 1, 2
2nd trigger: sequence converted 3, 6, 7
3rd trigger: sequence converted 9, 10 and an EOC event
generated
4th trigger: sequence converted 0, 1, 2

Injected group
Example:
n = 1, channels to be converted = 1, 2, 3
1st trigger: channel 1 converted
2nd trigger: channel 2 converted
3rd trigger: channel 3 converted and EOC and JEOC events
generated
4th trigger: channel 1
15
Calibration timging diagram
16
Calibration

17
Data alignment
18
DMA request
 規則通道轉換後的數值儲存在一個唯一的暫存

 只有在規則通道轉換結束後才能產生DMA的請

19
Temperature sensor

20
Temperature sensor (Con.)
 讀取溫度的方式:
2. 選擇取樣時間大於 2.2 μs
6. 利用下列公式得出溫度
21
Temperature sensor (Con.)
 讀取溫度的方式:
2. 選擇取樣時間大於 2.2 μs
6. 利用下列公式得出溫度

Avg_Slope ＝ 溫度與

22
Temperature sensor (Con.)
 溫度公式:
:溫度感測器在25度C

:溫度感測器的當前輸出電壓，

=
Vdd_convert_value(0xFFF)
:溫度感測器的輸

23

24
25

VCP輸出到螢幕上顯示。
26
Development Flow
Embedded Software Side
Connect the EVB
and the IOB
Programming
Bootup
STM32F10x
RCC Configure
GPIO Configure
DMA Configure
int main(void)
{
/* System USB configuration */
Set_System();
/*pause*/
getchar();
/* System clocks configuration */
RCC_Configuration();
/* GPIO configuration */
GPIO_Configuration();
/* DMA1 channel1 configuration */
DMA_Configuration();
printf("Configuration finish\n\r");
printf("Please presee DFU Button to get
Temperature\n\r");
while(1)
{
/*presee DFU Button to get Temperature*/
{
Count_Temperature();
}
}
27
28
Configure RCC
RCC FwLib Functions List
void RCC_Configuration(void)
{
/* Enable peripheral clocks ------------------------------*/
/* Enable DMA1 clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
/* Enable GPIOB clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
}
29
Configure GPIO
GPIO FwLib Functions List
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
30
{
/* ADC1 regular channel16 configuration */
/* Temperature Enable */
/* Enable ADC1 reset calibaration register */
/* Check the end of ADC1 reset calibration register */
/* Check the end of ADC1 calibration */
/* Start ADC1 Software Conversion */
}
31
32
33
34
35
36
37
38
DMA Block Diagram
DMA1 request mapping
40
Configure DMA
void DMA_Configuration(void)
{
DMA_DeInit(DMA1_Channel1);
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_BufferSize = 1;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
DMA_InitStructure.DMA_PeripheralDataSize =
DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel1, &DMA_InitStructure);
/* Enable DMA1 channel1 */
DMA_Cmd(DMA1_Channel1, ENABLE);
}
41
User code
void Count_Temperature(void)
{
//取溫度必須間隔一下，請使用Delay();
//溫度=
//印出現在溫度
}
42
Temperature sensor (Con.)
 溫度公式:
:溫度感測器在25度C

:溫度感測器的當前輸出電壓，

=
Vdd_convert_value(0xFFF)
:溫度感測器的輸

43
DEMO

44
```