Regular ADC

<< Click to Display Table of Contents >>

Navigation:  STM32F0 Target > Block References > On-chip Peripherals > ADC >

Regular ADC

Previous pageReturn to chapter overviewNext page

User Interface

How this block appears in a Simulink model?

stm32f0_adc_block

What can be configured?

stm32f0_adc_mask

Configuration item

Selectable option/ Value

Description

Module

1

Note: only module 1 available for this Target

ADC Sampling time

1.5 Cycles

7.5 Cycles

13.5 Cycles

28.5 Cycles

41.5 Cycles

55.5 Cycles

71.5 Cycles

239.5 Cycles

Select ADC sampling time

Output Data Type

Double

Single

Uint16

Select output data type for each ADC output port.

Each output data type return Raw value 0 to 4095 (12 bit resolutions).

Use Vref to convert from Raw to Volage:

Example, Voltage (V) = ADC Raw * Vref / 4095

Read ADC_ANx; x=0 to 15

Checked/ Un-checked

Check: Enable ADC channel

Un-checked: Disable ADC channel.

Read ADC_AN16 (TempSensor)

Checked/ Un-checked

Check: Enable reading internal temperature sensor.

Un-checked: Disable.

Read ADC_AN17 (Vrefint)

Checked/ Un-checked

Check: Enable reading internal voltage reference.

Un-checked: Disable.

Read ADC_AN18 (Vbat)

Checked/ Un-checked

Check: Enable reading VBAT level.

Un-checked: Disable.

Sample Time (Sec)

Sample time value in unit of second, default -1.

Configuration block sample time value.

Enable custom port labels

Checked/ Un-checked

Checked: enable custom port labels.

Custom output port labels

Port label with comma separate value.

Put the desired string to appear on port labels.

When to use this block?

Use this block for the application which need to process analog signal by software. Example, reading level of analog sensor (Temperature, Pressure, etc.), measure voltage and current from sensing circuit.

The Block's output are digital values between 0 to 4095. (STM32F0 ADC is 12 bits resolution.)

How does this block work?

This block will setup ADC reading function and return the reading value in 12 bit raw value.

Demos

Regular ADC demo