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

RM0016

General purpose I/O ports (GPIO)

 

 

11.7.2Interrupt capability

Each I/O can be configured as an input with interrupt capability by setting the CR2x bit while the I/O is in input mode. In this configuration, a signal edge or level input on the I/O generates an interrupt request.

Falling or rising edge sensitivity is programmed independently for each interrupt vector in the EXTI_CR[2:1] registers.

External interrupt capability is only available if the port is configured in input mode.

Interrupt masking

Interrupts can be enabled/disabled individually by programming the corresponding bit in the configuration register (Px_CR2). At reset state, the interrupts are disabled.

If a pin alternate function is TLI, use the Px_CR2 bit to enable/disable the TLI interrupt. The TLI interrupt is associated to a dedicated interrupt vector.

11.7.3Analog channels

Analog I/O channels can be selected by the ADC peripheral. The corresponding input and output stages are then automatically disabled. As mentioned in the next section, the input Schmitt trigger should be disabled in the ADC_TDR register when using the analog channels.

Table 23. Recommended and non-recommended configurations for analog input

DDR

CR1

CR2

ADC_TDR

Configuration

Comments

 

 

 

 

 

 

0

0

0

1

Floating Input without interrupt,

Recommended analog input

Schmitt trigger disabled

configuration

 

 

 

 

 

 

 

 

 

 

0

1

x

x

Input with pull-up enabled

Not recommended for analog input when

 

 

 

 

 

analog voltage is present since these

1

0

x

x

Output

configurations cause excess current flow

 

 

 

 

 

 

 

 

 

 

on the input pin.

1

1

x

x

Output

Both input and output stages are

 

 

 

 

 

disabled on ADC selected channel.

 

 

 

 

 

 

11.7.4Schmitt trigger

An internal input Schmitt trigger is included in some I/Os. The Schmitt trigger can be enabled/disabled using the ADC_TDR Schmitt trigger disable register.

11.8Output mode details

11.8.1Alternate function output

Alternate function outputs provide a direct path from a peripheral to an output or to an I/O pad, taking precedence over the port bit in the data output latch register (Px_ODR) and forcing the Px_DDR corresponding bit to 1.

Doc ID 14587 Rev 9

109/454

General purpose I/O ports (GPIO)

RM0016

 

 

An alternate function output can be push-pull or pseudo-open drain depending on the peripheral and Control register 1 (Px_CR1) and slope can be controlled depending on the Control register 2 (Px_CR2) values.

Examples:

SPI output pins must be set-up as push-pull, fast slope for optimal operation.

11.8.2Slope control

The maximum frequency that can be applied to an I/O can be controlled by software using the CR2 bit. Low frequency operation with improved EMC behavior is selected at reset. Higher frequency (up to 10 MHz) can be selected if needed. This feature can be applied in either open drain or push-pull output mode on I/O ports of output type O3 or O4. Refer to the pin description tables in the datasheets for the specific output type information for each pin.

110/454

Doc ID 14587 Rev 9

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