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

📄 serial.lst

📁 完成数据的采集
💻 LST
字号:
###############################################################################
#                                                                             #
#                                                       10/Jun/2008  15:10:59 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION                    #
# Copyright 1999-2007 IAR Systems. All rights reserved.                       #
#                                                                             #
#    Cpu mode     =  thumb                                                    #
#    Endian       =  little                                                   #
#    Source file  =  E:\ELE\yten\pro\Serial.c                                 #
#    Command line =  E:\ELE\yten\pro\Serial.c -lcN                            #
#                    E:\ELE\yten\pro\Debug\List\ -o                           #
#                    E:\ELE\yten\pro\Debug\Obj\ --debug --endian little       #
#                    --cpu Cortex-M3 -e --fpu None --dlib_config              #
#                    D:\IARARM\ARM\INC\DLib_Config_Normal.h -I                #
#                    E:\ELE\yten\pro\ -I E:\ELE\yten\pro\..\LIBRARY\INC\ -I   #
#                    D:\IARARM\ARM\INC\ -Oh                                   #
#    List file    =  E:\ELE\yten\pro\Debug\List\Serial.lst                    #
#    Object file  =  E:\ELE\yten\pro\Debug\Obj\Serial.o                       #
#                                                                             #
#                                                                             #
###############################################################################

E:\ELE\yten\pro\Serial.c
      1          /******************************************************************************/
      2          /* SERIAL.C: Low Level Serial Routines                                        */
      3          /******************************************************************************/
      4          /* This file is part of the uVision/ARM development tools.                    */
      5          /* Copyright (c) 2005-2007 Keil Software. All rights reserved.                */
      6          /* This software may only be used under the terms of a valid, current,        */
      7          /* end user licence from KEIL for a compatible version of KEIL software       */
      8          /* development tools. Nothing else gives you the right to use this software.  */
      9          /******************************************************************************/
     10          
     11          #include <stm32f10x_lib.h>              /* STM32F10x Library Definitions      */
     12          
     13          void SetupUART (void)  {
     14          
     15            GPIO_InitTypeDef  GPIO_InitStructure;
     16            USART_InitTypeDef USART_InitStructure;
     17          
     18            /* Enable GPIOA clock                                                       */
     19            RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
     20          
     21            /* Configure USART1 Rx (PA10) as input floating                             */
     22            GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_10;
     23            GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IN_FLOATING;
     24            GPIO_Init(GPIOA, &GPIO_InitStructure);
     25          
     26            /* Configure USART1 Tx (PA9) as alternate function push-pull                */
     27            GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_9;
     28            GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
     29            GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AF_PP;
     30            GPIO_Init(GPIOA, &GPIO_InitStructure);
     31          
     32            /* USART1 configured as follow:
     33                  - BaudRate = 115200 baud  
     34                  - Word Length = 8 Bits
     35                  - One Stop Bit
     36                  - No parity
     37                  - Hardware flow control disabled (RTS and CTS signals)
     38                  - Receive and transmit enabled
     39                  - USART Clock disabled
     40                  - USART CPOL: Clock is active low
     41                  - USART CPHA: Data is captured on the middle 
     42                  - USART LastBit: The clock pulse of the last data bit is not output to 
     43                                   the SCLK pin
     44            */
     45            USART_InitStructure.USART_BaudRate            = 115200;
     46            USART_InitStructure.USART_WordLength          = USART_WordLength_8b;
     47            USART_InitStructure.USART_StopBits            = USART_StopBits_1;
     48            USART_InitStructure.USART_Parity              = USART_Parity_No ;
     49            USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
     50            USART_InitStructure.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;
     51            USART_InitStructure.USART_Clock               = USART_Clock_Disable;
     52            USART_InitStructure.USART_CPOL                = USART_CPOL_Low;
     53            USART_InitStructure.USART_CPHA                = USART_CPHA_2Edge;
     54            USART_InitStructure.USART_LastBit             = USART_LastBit_Disable;
     55            USART_Init(USART1, &USART_InitStructure);
     56          
     57            USART_Cmd(USART1, ENABLE);            /* Enable USART1                      */
     58          }
     59          
     60          
     61          /* Implementation of putchar (also used by printf function to output data)    */
     62          int SendChar (int ch)  {                /* Write character to Serial Port     */
     63          
     64            USART_SendData(USART1, (unsigned char) ch);
     65            while (!(USART1->SR & USART_FLAG_TXE));
     66            return (ch);
     67          }
     68          
     69          
     70          int GetKey (void)  {                    /* Read character from Serial Port    */
     71          
     72            while (!(USART1->SR & USART_FLAG_RXNE));
     73            return (USART_ReceiveData(USART1));
     74          }

   Maximum stack usage in bytes:

     Function  .cstack
     --------  -------
     GetKey         8
     SendChar      16
     SetupUART     40


   Section sizes:

     Function/Label Bytes
     -------------- -----
     SetupUART       124
     SendChar         24
     GetKey           18
     ??DataTable2      4

 
 170 bytes in section .text
 
 170 bytes of CODE memory

Errors: none
Warnings: none

⌨️ 快捷键说明

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