| công cụ tìm kiếm bảng dữ liệu linh kiện điện tử |
|
AN3427 bảng dữ liệu(PDF) 43 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3427 bảng dữ liệu(HTML) 43 Page - STMicroelectronics |
|
43 / 52 page ![]() AN3427 Firmware migration using the library Doc ID 019001 Rev 1 43/52 4.4 GPIO This section explain how to update the configuration of the different GPIO modes when moving the application code from STM32 F1 series to F2 series. 4.4.1 Output mode The example below shows how to configure an I/O in output mode (for example to drive an LED) in STM32 F1 series: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_xxMHz;/* 2, 10 or 50 MHz */ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOy, &GPIO_InitStructure); In F2 series you have to update this code as follows: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; /* Push-pull or open drain */ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /* None, Pull-up or pull-down */ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_xxMHz; /* 2, 25, 50 or 100 MHz */ GPIO_Init(GPIOy, &GPIO_InitStructure); 4.4.2 Input mode The example below shows how to configure an I/O in input mode (for example to be used as an EXTI line) in STM32 F1 series: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOy, &GPIO_InitStructure); In F2 series you have to update this code as follows: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; /* None, Pull-up or pull-down */ GPIO_Init(GPIOy, &GPIO_InitStructure); 4.4.3 Analog mode The example below shows how to configure an I/O in analog mode (for example an ADC or DAC channel) in STM32 F1 series: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOy, &GPIO_InitStructure); In F2 series you have to update this code as follows: GPIO_InitStructure.GPIO_Pin = GPIO_Pin_x ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOy, &GPIO_InitStructure); 4.4.4 Alternate function mode In STM32 F1 series 1. The configuration to use an I/O as alternate function depends on the peripheral mode used. For example, the USART Tx pin should be configured as alternate function push- pull while the USART Rx pin should be configured as input floating or input pull-up. 2. To optimize the number of peripherals available in MCUs that have fewer pins (smaller package size), it is possible by software to remap some alternate functions to other |
|
Link URL |
| Cho đến nay ALLDATASHEET có giúp ích cho doanh nghiệp của bạn hay không? [ DONATE ] |
Alldatasheet là | Quảng cáo | Liên lạc với chúng tôi | Chính sách bảo mật | Liên kết đến bảng dữ liệu | Trao đổi link | Tìm kiếm theo nhà sản xuất All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |