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

📄 uart2.lst

📁 ADuC7020/26是ADI模拟公司开发的ARM7TDMI内核
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.32c,  UART2                                                                14/09/05  13:25:50  PAGE 1   


ARM COMPILER V2.32c, COMPILATION OF MODULE UART2
OBJECT MODULE PLACED IN UART2.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe UART2.c THUMB DEBUG TABS(4) 

stmt  level    source

    1          /*********************************************************************
    2          
    3           Author        : ADI - Apps            www.analog.com/MicroConverter
    4          
    5           Date          : Sept. 2005
    6          
    7           File          : UART2.c
    8          
    9           Hardware      : Applicable to ADuC702x rev H or I silicon
   10                           Currently targetting ADuC7026.
   11          
   12           Description   : Read part of memory and output through UART (SPM0&1).
   13                           The baudrate is calculated with the following formula:
   14           
   15                              DL = HCLK                                          
   16                                  _______                                        
   17                                  Baudrate * 2 *16                               
   18          
   19                           A 9600 8-N-1 Hyperterminal window is required to observe
   20                           the results.
   21                  
   22          *********************************************************************/
   23          #include <ADuC7026.h>
   24          
   25                       
   26          void senddata(short);
   27          void delay(int);
   28          char hex2ascii(char);
   29          
   30          int main (void)  {
   31   1      
   32   1      static unsigned short SOMEDATA[1024];
   33   1      int i;
   34   1      
   35   1          GP0CON = 0x10000000;        // enable ECLK output on P0.5
   36   1      
   37   1          // configures GPIO to flash LED P4.2
   38   1          GP4DAT = 0x04000000;        // P4.2 configured as an output. LED is turned on   
   39   1      
   40   1          // Setup tx & rx pins on SPM 0 and SPM 1
   41   1          GP1CON = 0x011;
   42   1      
   43   1           // Start setting up UART at 9600bps
   44   1          COMCON0 = 0x080;            // Setting DLAB
   45   1          COMDIV0 = 0x088;            // Setting DIV0 and DIV1 to DL calculated
   46   1          COMDIV1 = 0x000;
   47   1          COMCON0 = 0x007;            // Clearing DLAB
   48   1      
   49   1          for (i=0; i <1024; i++)
   50   1          {
   51   2              SOMEDATA[i]=i;
   52   2          }   
   53   1          
   54   1          while(1)
   55   1          {
   56   2          for (i=0; i <1024; i++)
   57   2          {
   58   3              senddata (SOMEDATA[i]);
   59   3          }
ARM COMPILER V2.32c,  UART2                                                                14/09/05  13:25:50  PAGE 2   

   60   2          GP4DAT ^= 0x00040000;       // Complement P4.2
   61   2          delay(2000);
   62   2          }
   63   1      }
   64          
   65          
   66          void delay (int length)
   67          {
   68   1          while (length >=0)
   69   1              length--;
   70   1      }
   71          
   72          void senddata(short to_send)
   73          {
   74   1          while(!(0x020==(COMSTA0 & 0x020))){}
   75   1              COMTX = 0x0A;                       // output LF 
   76   1          while(!(0x020==(COMSTA0 & 0x020))){}
   77   1              COMTX = 0x0D;                       // output CR 
   78   1          while(!(0x020==(COMSTA0 & 0x020))){}
   79   1              COMTX = hex2ascii ((to_send >> 8) & 0x0F);
   80   1          while(!(0x020==(COMSTA0 & 0x020))){}
   81   1              COMTX = hex2ascii ((to_send >> 4) & 0x0F);                      
   82   1          while(!(0x020==(COMSTA0 & 0x020))){}
   83   1              COMTX = hex2ascii (to_send & 0x0F);                         
   84   1      }
   85          
   86          
   87          char hex2ascii(char toconv)
   88          {
   89   1          if (toconv<0x0A) 
   90   1          {
   91   2              toconv += 0x30;
   92   2          }
   93   1          else 
   94   1          {
   95   2              toconv += 0x37;
   96   2          }
   97   1          
   98   1          return (toconv);
   99   1      }
  100          
ARM COMPILER V2.32c,  UART2                                                                14/09/05  13:25:50  PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN NUMBER (__startup)



*** PUBLICS:
 PUBLIC         senddata?T
 PUBLIC         delay?T
 PUBLIC         hex2ascii?T
 PUBLIC         main



*** DATA SEGMENT '?DT0?UART2':
 00000000          SOMEDATA:
 00000000            DS          2048



*** CODE SEGMENT '?PR?main?UART2':
   30: int main (void)  {
 00000000  B500      PUSH        {LR}
 00000002            ; SCOPE-START
   35:        GP0CON = 0x10000000;         // enable ECLK output on P0.5
 00000002  4800      LDR         R1,=0x10000000
 00000004  4800      LDR         R0,=0xFFFFF400
 00000006  6001      STR         R1,[R0,#0x0]
   38:     GP4DAT = 0x04000000;        // P4.2 configured as an output. LED is turned on   
 00000008  4800      LDR         R1,=0x4000000
 0000000A  4800      LDR         R0,=0xFFFFF460
 0000000C  6001      STR         R1,[R0,#0x0]
   41:     GP1CON = 0x011;
 0000000E  2111      MOV         R1,#0x11
 00000010  4800      LDR         R0,=0xFFFFF404
 00000012  6001      STR         R1,[R0,#0x0]
   44:        COMCON0 = 0x080;         // Setting DLAB
 00000014  2180      MOV         R1,#0x80
 00000016  4800      LDR         R0,=0xFFFF070C
 00000018  6001      STR         R1,[R0,#0x0]
   45:        COMDIV0 = 0x088;         // Setting DIV0 and DIV1 to DL calculated
 0000001A  2188      MOV         R1,#0x88
 0000001C  4800      LDR         R0,=0xFFFF0700
 0000001E  6001      STR         R1,[R0,#0x0]
   46:        COMDIV1 = 0x000;
 00000020  2100      MOV         R1,#0x0
 00000022  4800      LDR         R0,=0xFFFF0704
 00000024  6001      STR         R1,[R0,#0x0]
   47:        COMCON0 = 0x007;         // Clearing DLAB
 00000026  2107      MOV         R1,#0x7
 00000028  4800      LDR         R0,=0xFFFF070C
 0000002A  6001      STR         R1,[R0,#0x0]
   49:     for (i=0; i <1024; i++)
 0000002C  2400      MOV         R4,#0x0
 0000002E  ---- Variable 'i' assigned to Register 'R4' ----
 0000002E          L_4:
   51:         SOMEDATA[i]=i;
 0000002E  1C20      MOV         R0,R4 ; i
 00000030  1C22      MOV         R2,R4 ; i
 00000032  0052      LSL         R2,R2,#0x1 ; i
 00000034  4800      LDR         R1,=SOMEDATA ; SOMEDATA
 00000036  5288      STRH        R0,[R1,R2]
   52:     }    
 00000038  3401      ADD         R4,#0x1
 0000003A  1C20      MOV         R0,R4 ; i
 0000003C  4800      LDR         R1,=0x400
 0000003E  4288      CMP         R0,R1 ; i
 00000040  DBF5      BLT         L_4  ; T=0x0000002E
   56:     for (i=0; i <1024; i++)
 00000042          L_14:
ARM COMPILER V2.32c,  UART2                                                                14/09/05  13:25:50  PAGE 4   

 00000042  2400      MOV         R4,#0x0

⌨️ 快捷键说明

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