Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
162
Добавлен:
01.03.2016
Размер:
3.56 Mб
Скачать

Analog/digital converter (ADC)

RM0016

 

 

24.5.7Conversion on external trigger

Conversion can be triggered by an rising edge event on the ADC_ETR pin or a TRGO event from a timer. Refer to the datasheet for details on the timer trigger, as this is product dependent). If the EXTTRIG control bit is set then either of the external events can be used to trigger a conversion. The EXTSEL[1:0] bits are used to select the two possible sources of events that can trigger conversion.

To use external trigger mode:

1.The ADC is in off state (ADON=0) and EOC bit is cleared.

2.Select trigger source (EXTSEL [1:0]).

3.Set external trigger mode EXTTRIG=1 using a BSET instruction in order not to change other bits in the register.

4.If the trigger source is in high state, this switches on the ADC. For this reason, test if ADC is switched off (ADON=0), then switch on ADC (ADON=1).

5.Wait for the stabilization time (tSTAB). If an external trigger occurs before tSTAB elapses, the result will not be accurate.

6.Conversion starts when an external trigger event occurs.

Note: 1 If timer trigger mode is selected (timer event as trigger source, not external pin) it is recommended to start the timer only when the ADC is completely set - and stop the timer before the ADC is switched off.

2External trigger mode must be disabled (EXTTRIG=0) before executing a HALT instruction.

24.5.8Analog zooming

Analog zooming is supported in devices with external reference voltage pins (VREF+ and VREF-). In analog zooming, the reference voltage is chosen to allow increased resolution in a reduced voltage range. Refer to the datasheet for details on the allowed reference voltage range.

24.5.9Timing diagram

As shown in Figure 162, after ADC power on, the ADC needs a stabilization time tSTAB (equivalent to one conversion time tCONV) before it starts converting accurately. For subsequent conversions there is no stabilization delay and ADON needs to be set only once. The ADC conversion time takes 14 clock cycles. After conversion the EOC flag is set and the 10-bit ADC Data register contains the result of the conversion.

420/454

Doc ID 14587 Rev 9

RM0016

Analog/digital converter (ADC)

 

 

Figure 162. Timing diagram in single mode (CONT = 0)

fADC

Software sets ADON bit 1st time

Software sets ADON bit 2nd time

ADON

ADC Conversion

ADC

tSTAB

 

Conversion Time (tCONV)

 

 

 

 

 

 

 

EOC

Software resets EOC bit

Figure 163. Timing diagram in continuous mode (CONT = 1)

fADC

 

 

 

Software sets ADON bit 1st time

Software sets ADON bit 2nd time

Software resets ADON or CONT bit

 

 

 

ADON

 

 

 

ADC

1st Conversion

2nd Conversion

nth ADC Conversion

 

 

 

tSTAB

tCONV

tCONV

 

EOC

 

 

 

 

 

Software resets EOC bit

Doc ID 14587 Rev 9

421/454

Соседние файлы в папке Минимум документации STM8_1