⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.txt

📁 STM32的串口例程
💻 TXT
📖 第 1 页 / 共 2 页
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 939] for uVision
; commandline ArmCC [--split_sections --debug -c --asm --interleave -o.\obj\main.o --depend=.\obj\main.d --device=DARMSTM --apcs=interwork -O0 -I..\..\library\inc -I..\..\library\src -I..\uvsion -IC:\KeilARM\ARM\INC\ST\STM32F10x --omf_browse=.\obj\main.crf main.c]
                          THUMB

                          AREA ||i.USART_Configuration||, CODE, READONLY, ALIGN=2

                  USART_Configuration PROC
;;;201    void USART_Configuration(void)
;;;202    {
000000  b500              PUSH     {lr}
000002  b087              SUB      sp,sp,#0x1c
;;;203      USART_InitTypeDef USART_InitStructure;
;;;204      USART_ClockInitTypeDef  USART_ClockInitStructure;
;;;205    /* USART1 configuration -----------------------------------------------
;;;206    
;;;207    -------*/
;;;208      /* USART1 configured as follow:
;;;209            - BaudRate = 115200 baud  
;;;210            - Word Length = 8 Bits
;;;211            - One Stop Bit
;;;212            - No parity
;;;213            - Hardware flow control disabled (RTS and CTS signals)
;;;214            - Receive and transmit enabled
;;;215            - USART Clock disabled
;;;216            - USART CPOL: Clock is active low
;;;217            - USART CPHA: Data is captured on the middle 
;;;218            - USART LastBit: The clock pulse of the last data bit is not 
;;;219    
;;;220    output to 
;;;221                             the SCLK pin
;;;222      */
;;;223    USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
000004  2000              MOVS     r0,#0
000006  f8ad0004          STRH     r0,[sp,#4]
;;;224    USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
00000a  f8ad0006          STRH     r0,[sp,#6]
;;;225    USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
00000e  f44f7000          MOV      r0,#0x200
000012  f8ad0008          STRH     r0,[sp,#8]
;;;226    USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;
000016  2000              MOVS     r0,#0
000018  f8ad000a          STRH     r0,[sp,#0xa]
;;;227    /* Configure the USART1 synchronous paramters */
;;;228    USART_ClockInit(USART1, &USART_ClockInitStructure);
00001c  a901              ADD      r1,sp,#4
00001e  480e              LDR      r0,|L1.88|
000020  f7fffffe          BL       USART_ClockInit
;;;229    
;;;230    USART_InitStructure.USART_BaudRate = 115200;
000024  f44f30e1          MOV      r0,#0x1c200
000028  9003              STR      r0,[sp,#0xc]
;;;231    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
00002a  2000              MOVS     r0,#0
00002c  f8ad0010          STRH     r0,[sp,#0x10]
;;;232    USART_InitStructure.USART_StopBits = USART_StopBits_1;
000030  f8ad0012          STRH     r0,[sp,#0x12]
;;;233    USART_InitStructure.USART_Parity = USART_Parity_No ;
000034  f8ad0014          STRH     r0,[sp,#0x14]
;;;234    USART_InitStructure.USART_HardwareFlowControl = 
000038  f8ad0018          STRH     r0,[sp,#0x18]
;;;235    
;;;236    USART_HardwareFlowControl_None;
;;;237    
;;;238    
;;;239    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
00003c  200c              MOVS     r0,#0xc
00003e  f8ad0016          STRH     r0,[sp,#0x16]
;;;240    /* Configure USART1 basic and asynchronous paramters */
;;;241    USART_Init(USART1, &USART_InitStructure);
000042  a903              ADD      r1,sp,#0xc
000044  4804              LDR      r0,|L1.88|
000046  f7fffffe          BL       USART_Init
;;;242        
;;;243      /* Enable USART1 */
;;;244      USART_Cmd(USART1, ENABLE);
00004a  2101              MOVS     r1,#1
00004c  4802              LDR      r0,|L1.88|
00004e  f7fffffe          BL       USART_Cmd
;;;245    }
000052  b007              ADD      sp,sp,#0x1c
000054  bd00              POP      {pc}
;;;246    
                          ENDP

000056  0000              DCW      0x0000
                  |L1.88|
000058  40013800          DCD      0x40013800

                          AREA ||i.GPIO_Configuration||, CODE, READONLY, ALIGN=2

                  GPIO_Configuration PROC
;;;178    void GPIO_Configuration(void)
;;;179    {
000000  b508              PUSH     {r3,lr}
;;;180      GPIO_InitTypeDef GPIO_InitStructure;
;;;181    
;;;182      /* Configure USART1 Tx (PA.09) as alternate function push-pull */
;;;183      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
000002  f44f7000          MOV      r0,#0x200
000006  f8ad0000          STRH     r0,[sp,#0]
;;;184      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
00000a  2018              MOVS     r0,#0x18
00000c  f88d0003          STRB     r0,[sp,#3]
;;;185      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
000010  2003              MOVS     r0,#3
000012  f88d0002          STRB     r0,[sp,#2]
;;;186      GPIO_Init(GPIOA, &GPIO_InitStructure);
000016  4669              MOV      r1,sp
000018  4807              LDR      r0,|L2.56|
00001a  f7fffffe          BL       GPIO_Init
;;;187        
;;;188      /* Configure USART1 Rx (PA.10) as input floating */
;;;189      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
00001e  f44f6080          MOV      r0,#0x400
000022  f8ad0000          STRH     r0,[sp,#0]
;;;190      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
000026  2004              MOVS     r0,#4
000028  f88d0003          STRB     r0,[sp,#3]
;;;191      GPIO_Init(GPIOA, &GPIO_InitStructure);
00002c  4669              MOV      r1,sp
00002e  4802              LDR      r0,|L2.56|
000030  f7fffffe          BL       GPIO_Init
;;;192    }
000034  bd08              POP      {r3,pc}
;;;193    
                          ENDP

000036  0000              DCW      0x0000
                  |L2.56|
000038  40010800          DCD      0x40010800

                          AREA ||i.NVIC_Configuration||, CODE, READONLY, ALIGN=1

                  NVIC_Configuration PROC
;;;160    void NVIC_Configuration(void)
;;;161    {
000000  b510              PUSH     {r4,lr}
;;;162    #ifdef  VECT_TAB_RAM  
;;;163      /* Set the Vector Table base location at 0x20000000 */ 
;;;164      NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); 
;;;165    #else  /* VECT_TAB_FLASH  */
;;;166      /* Set the Vector Table base location at 0x08000000 */ 
;;;167      NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   
000002  2100              MOVS     r1,#0
000004  f04f6000          MOV      r0,#0x8000000
000008  f7fffffe          BL       NVIC_SetVectorTable
;;;168    #endif
;;;169    }
00000c  bd10              POP      {r4,pc}
;;;170    
                          ENDP


                          AREA ||i.RCC_Configuration||, CODE, READONLY, ALIGN=2

                  RCC_Configuration PROC
;;;102    void RCC_Configuration(void)
;;;103    {
000000  b510              PUSH     {r4,lr}
;;;104      /* RCC system reset(for debug purpose) */
;;;105      RCC_DeInit();
000002  f7fffffe          BL       RCC_DeInit
;;;106    
;;;107      /* Enable HSE */
;;;108      RCC_HSEConfig(RCC_HSE_ON);
000006  f44f3080          MOV      r0,#0x10000
00000a  f7fffffe          BL       RCC_HSEConfig
;;;109    
;;;110      /* Wait till HSE is ready */
;;;111      HSEStartUpStatus = RCC_WaitForHSEStartUp();
00000e  f7fffffe          BL       RCC_WaitForHSEStartUp
000012  4919              LDR      r1,|L4.120|
000014  7008              STRB     r0,[r1,#0]  ; HSEStartUpStatus
;;;112    
;;;113      if(HSEStartUpStatus == SUCCESS)
000016  4608              MOV      r0,r1
000018  7800              LDRB     r0,[r0,#0]  ; HSEStartUpStatus
00001a  2801              CMP      r0,#1
00001c  d126              BNE      |L4.108|
;;;114      {
;;;115        /* HCLK = SYSCLK */
;;;116        RCC_HCLKConfig(RCC_SYSCLK_Div1); 
00001e  2000              MOVS     r0,#0
000020  f7fffffe          BL       RCC_HCLKConfig
;;;117      
;;;118        /* PCLK2 = HCLK */
;;;119        RCC_PCLK2Config(RCC_HCLK_Div1); 
000024  2000              MOVS     r0,#0
000026  f7fffffe          BL       RCC_PCLK2Config
;;;120    
;;;121        /* PCLK1 = HCLK/2 */
;;;122        RCC_PCLK1Config(RCC_HCLK_Div2);
00002a  f44f6080          MOV      r0,#0x400
00002e  f7fffffe          BL       RCC_PCLK1Config
;;;123    
;;;124        /* Flash 2 wait state */
;;;125        FLASH_SetLatency(FLASH_Latency_2);
000032  2002              MOVS     r0,#2
000034  f7fffffe          BL       FLASH_SetLatency

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -