Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.

Similar presentations


Presentation on theme: "Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN."— Presentation transcript:

1 Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN

2 ADC Hardware Three 12-bit analog-to-digital converters are embedded and each ADC shares up to 16 external channels, performing conversions in the single-shot or scan mode. In scan mode, automatic conversion is performed on a selected group of analog inputs. The ADC can be served by the DMA controller. An analog watchdog feature allows very precise monitoring of the converted voltage of one, some or all selected channels. An interrupt is generated when the converted voltage is outside the programmed thresholds. To synchronize A/D conversion and timers, the ADCs could be triggered by any of TIM1, TIM2, TIM3, TIM4, TIM5, or TIM8 timer.

3 Temperature Sensor / VBat The temperature sensor has to generate a voltage that varies linearly with temperature. The temperature sensor is internally connected to the ADC1_IN16 input channel which is used to convert the sensor output voltage into a digital value.

4 ADC Hardware STM32F405xx/STM32F407xx Datasheet

5 ADC Characteristics

6 Tempereture/Battery Sensor Characteristics

7 ADC Registers Regular mode: SWSTART: ADCx->CR2 bit#30 Injected mode: JSWSTART: ADCx->CR2 bit#22 Activate ADC: ADON: ADCx->CR2 bit#0 End of conversion conntrol : EOC: ADCx->SR bit#1 End of conversion control : JEOC: ADCx->SR bit#2 Read the result when conversion ends: Regular Mode: İnjected Mode: Result DATA REGISTER: ADCx->DR Result DATA REGISTER: ADCx->JDR

8 Clock: ADC1: RCC->APB2ENR -> bit#8 ADC2: RCC->APB2ENR -> bit#9 ADC3: RCC->APB2ENR -> bit#10 ADC Prescaler: (if needed) ADC->CCR -> bit# 17:16

9

10 Regular mode: Sequence length: SQR1: ADCx->SQR1 bit#23:20 SQR1,SQR2,SQR3: give the sequence in the desired order Injected mode: Sequence length: JSQR: ADCx->JSQR bit#21:20 JSQR : give the sequence in the desired order

11 Enable temperature sensor: TSVREFE: ADC->CCR bit#23

12

13 Single conversion mode operation

14 Cont. conversion mode operation Continious conversion: CONT: ADCx->CR2 bit#1

15 Timing Diagram

16 Analog watchdog: ADCx->HTR: High threshold ADCx->LTR: Low threshold AWDEN: ADCx->CR1 bit#23 AWDSGL: ADCx->CR1: bit#9 AWDCH: ADCx->CR1 bit#4:0 Injected Channels: JAWDEN: ADCx->CR1 bit#22

17 SCAN: ADCx->CR1 bit#8

18 Channelx sampling time selection: ADCx->SMPR1 ADCx->SMPR2 ADCx->SMPR3 Wrıte the proper setting to the area of channel which will be set.


Download ppt "Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN."

Similar presentations


Ads by Google