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

RM0016

Analog/digital converter (ADC)

 

 

24.8Data alignment

ALIGN bit in the ADC_CR2 register selects the alignment of data stored after conversion. Data can be aligned in the following ways.

Right Alignment: 8 Least Significant bits are written in the ADC_DL register, then the remaining Most Significant bits are written in the ADC_DH register. The Least Significant Byte must be read first followed by the Most Significant Byte. In this case, the LDW instruction can be used as it has the same reading order.

Figure 164. Right alignment of data

D9 D8

ADC_DRH

D7

D6

D5

D4

D3

D2

D1

D0

 

 

 

 

 

 

 

 

ADC_DRL

Left Alignment: 8 Most Significant bits are written in the ADC_DH register, then the remaining Least Significant bits are written in the ADC_DL register. The Most Significant Byte must be read first followed by the Least Significant Byte.

Figure 165. Left alignment of data

D9

D8

D7

D6

D5

D4

D3

D2

 

 

 

 

 

 

 

 

ADC_DRH

D1 D0

ADC_DRL

24.9Reading the conversion result

The conversion results from ADC_DRH and ADC_DRL data registers must be read in a specific order to guarantee data coherency. This order depends on the data alignment (refer to Section 24.8: Data alignment).

When the ADC1DBxRH and ADC1DBxRL data buffer registers are read (ADC1 only), there is no internal locking mechanism. Therefore, the user must check the OVR flag in the ADC_CR3 register after having read the ADC1DBxRH and AD1CDBxRL registers. If the OVR flag is cleared, this ensures that the values just read from the ADC1DBxRH and AD1CDBxRL registers are consistent.

Another way to ensure data consistency (with right alignment of data) is to read ADC1DBxRH and ADC1DBxRL with the following sequence, which must not be interrupted: ADC_READ:

LDW X,#ADC_DB0RH

CPW X,#ADC_DB0RH JREQ ADC_END LDW X,#ADC_DB0RH ADC_END:

Doc ID 14587 Rev 9

425/454

Analog/digital converter (ADC)

RM0016

 

 

24.10Schmitt trigger disable registers

The ADC_TDRH and ADC_TDRL registers are used to disable the Schmitt triggers available in the AIN analog input pins. Disabling the Schmitt trigger lowers the power consumption in the I/Os.

426/454

Doc ID 14587 Rev 9

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