microcontroller based system design

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

Upload: whitney

Post on 07-Feb-2016

45 views

Category:

Documents


0 download

DESCRIPTION

Microcontroller based system design. Asst. Prof. Dr. Alper ŞİŞMAN. ADC Hardware. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Microcontroller based system design

Microcontroller based system design

Asst. Prof. Dr. Alper ŞİŞMAN

Page 2: Microcontroller based system design

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.

Page 3: Microcontroller based system design

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.

Page 4: Microcontroller based system design

ADC Hardware

STM32F405xx/STM32F407xxDatasheet

Page 5: Microcontroller based system design

ADC Characteristics

Page 6: Microcontroller based system design

Tempereture/Battery Sensor Characteristics

Page 7: Microcontroller based system design

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

Page 8: Microcontroller based system design

Clock: ADC1: RCC->APB2ENR -> bit#8ADC2: RCC->APB2ENR -> bit#9 ADC3: RCC->APB2ENR -> bit#10

ADC Prescaler: (if needed)ADC->CCR -> bit# 17:16

Page 9: Microcontroller based system design
Page 10: Microcontroller based system design

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

Page 11: Microcontroller based system design

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

Page 12: Microcontroller based system design
Page 13: Microcontroller based system design

Single conversion mode operation

Page 14: Microcontroller based system design

Cont. conversion mode operation

Continious conversion:CONT: ADCx->CR2 bit#1

Page 15: Microcontroller based system design

Timing Diagram

Page 16: Microcontroller based system design

Analog watchdog:ADCx->HTR: High thresholdADCx->LTR: Low thresholdAWDEN: ADCx->CR1 bit#23AWDSGL: ADCx->CR1: bit#9AWDCH: ADCx->CR1 bit#4:0

Injected Channels:JAWDEN: ADCx->CR1 bit#22

Page 17: Microcontroller based system design

SCAN: ADCx->CR1 bit#8

Page 18: Microcontroller based system design

Channelx sampling time selection:ADCx->SMPR1ADCx->SMPR2ADCx->SMPR3

Wrıte the proper setting to the area of channel which will be set.