| Moteur de recherche de fiches techniques de composants électroniques |
|
AN4018 Fiches technique(PDF) 19 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4018 Fiches technique(HTML) 19 Page - STMicroelectronics |
|
19 / 23 page ![]() DocID022544 Rev 3 19/23 AN4018 Example to configure the communication protocol Appendix C Example to configure the communication protocol C.1 Configure the STM32Fx family serial layer Follow the STM32Fx family USART configuration used inside the serial layer to communicate with a PLM device: Usart ' USART3 USART_RX_GPIO ' GPIO_Pin_11_PORT_B USART_TX_GPIO ' GPIO_Pin_10_PORT_B The part of the code to modify is: /*-----------------------------------------------------------*/ /* Serial Define */ #define USART USART3 #define USART_PORT GPIOB #define USART_TX GPIO_Pin_10 #define USART_RX GPIO_Pin_11 #define USART_TR GPIO_Pin_9 #define USART_IRQ USART3_IRQn #define RCC_APBPeriph_USART RCC_APB1Periph_USART3 #define RCC_APBPeriph_USART_ClockCmd(Periph_USART,value) RCC_APB1PeriphClockCmd(Periph_USART,value) #define RCC_APBPeriph_GPIO RCC_APB2Periph_GPIOB #define RCC_APBPeriph_GPIO_ClockCmd(Periph_GPIO,value) RCC_APB2PeriphClockCmd(Periph_GPIO,value) /*------------------------------------------------------------*/ The names "RCC_APB2Periph_GPIOB", "GPIO_Pin_x", "USART3" ecc. The names are defined in the STM32F10x_StdPeriph_Driver. Furthermore, it is necessary to call the function “vUARTInterruptHandler()” defined in serial.c in the appropriate InterruptServiceRoutine. The following example shows the ISR of USART3 in the Interrupt file of the STM32Fx family library: Example: void PPP_IRQHandler(void) { } void UART4_IRQHandler(void) { } void USART3_IRQHandler(void) { vUARTInterruptHandler(); } void USART1_IRQHandler(void) |
|
|
Lien URL |
| ALLDATASHEET vous a-t-il été utile ? [ DONATE ] |
À propos de Alldatasheet | Publicité | Contactez-nous | Politique de confidentialité | Lien vers la fiche technique | Echange de liens | Fabricants 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 |