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

📄 main.lst

📁 ADuC7020/26是ADI模拟公司开发的ARM7TDMI内核
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.42,  main                                                                  09/01/06  14:41:41  PAGE 1   


ARM COMPILER V2.42, COMPILATION OF MODULE main
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe main.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          : main.c
    8          
    9           Hardware      : Applicable to ADuC702x rev H or I silicon
   10                           Currently targetting ADuC7026.
   11          
   12           Description   : Demonstrates the use of the external RAM
   13                           on the AduC702x boards. ADC0 is used to
   14                           take in a signal which is first stored in
   15                           external RAM, and then sent to the UART
   16                  
   17          *********************************************************************/
   18          
   19          #include <ADuC7026.H>                       //ADuC7024 definitions
   20          #define N 0x8000                            //Maximum = 65534 samples
   21          
   22          
   23          void start_conversion(void);                //ADC code sequence
   24          void senddata(short);                       //Send ASCII code to serial port
   25          char hex2ascii(char);                       //Convert hex to ASCII
   26          void ADCpoweron(int);
   27          
   28          int main(){
   29   1          ADCpoweron(20000);                      //Power on ADC
   30   1      
   31   1          ADCCP = 0x00;                           //Select ADC channel 0
   32   1          REFCON = 0x01;                          //Internal 2.5V reference. 2.5V on Vref pin
   33   1          
   34   1          GP1CON = 0x011;                         // Setup tx & rx pins on P1.0 and P1.1
   35   1          GP0CON = 0x220;                         // ext mem mode for BHE & BLE
   36   1          GP2CON = 0x22222220;
   37   1          GP3CON = 0x22222222;
   38   1          GP4CON = 0x22222222;
   39   1          
   40   1          XMCFG = 0x1;
   41   1          XM0CON = 0x3;                           // enable ext mem in 16-bit mode
   42   1          XM0PAR = 0x70FF;
   43   1                                                  //Start setting up UART at 9600bps
   44   1          COMCON0 = 0x80;                         //Setting DLAB
   45   1          COMDIV0 = 0x88;                         //9600bps       
   46   1          COMDIV1 = 0x00;                                      
   47   1          COMCON0 = 0x07;                         //Clearing DLAB
   48   1      
   49   1          while(1){
   50   2              start_conversion();
   51   2          }
   52   1      }
   53          
   54          
   55          void start_conversion(void){
   56   1          int i;
   57   1          unsigned short * data_ptr;              // Conversion information stored here
   58   1          data_ptr = (unsigned short *)0x10000000;
   59   1          
ARM COMPILER V2.42,  main                                                                  09/01/06  14:41:41  PAGE 2   

   60   1          ADCCON = 0x6E4;                         //Start continuous conversion           
   61   1      
   62   1          for(i=0;i<N;i++){
   63   2              while(!ADCSTA){}                    // Wait for end of conversion
   64   2              *data_ptr = (ADCDAT >> 16);         // Store converison in external ram
   65   2              data_ptr ++;
   66   2          }
   67   1          ADCCON = 0x620;                         //Stops continuous conversion
   68   1          data_ptr = (unsigned short *)0x10000000;
   69   1                  for(i=0;i<N;i++){
   70   2                      senddata(*data_ptr);
   71   2                      data_ptr++;
   72   2          }
   73   1      }
   74          
   75          
   76          void senddata(short to_send) {
   77   1          while(!(0x020==(COMSTA0 & 0x020))){}
   78   1              COMTX = 0x0A;                           //Output LF 
   79   1          while(!(0x020==(COMSTA0 & 0x020))){}
   80   1              COMTX = 0x0D;                           //Output CR 
   81   1          while(!(0x020==(COMSTA0 & 0x020))){}
   82   1              COMTX = hex2ascii ((to_send >> 8) & 0x0F);
   83   1          while(!(0x020==(COMSTA0 & 0x020))){}
   84   1              COMTX = hex2ascii ((to_send >> 4) & 0x0F);                      
   85   1          while(!(0x020==(COMSTA0 & 0x020))){}
   86   1              COMTX = hex2ascii (to_send & 0x0F);
   87   1      }
   88          
   89          char hex2ascii(char toconv) {
   90   1          if (toconv<0x0A)                            //If hex digit is greater than 'A'
   91   1          {                                           //then add 37h to the hex digit to make
   92   2              toconv += 0x30;                         //an ascii letter
   93   2          }                                           //If hex digit is less than 'A'
   94   1          else                                        //then add 30h to it to make
   95   1          {                                           //an ascii number
   96   2              toconv += 0x37;
   97   2          }
   98   1          
   99   1          return (toconv);
  100   1      }
  101          
  102          void ADCpoweron(int time) {
  103   1          ADCCON = 0x620;                     // power-on the ADC
  104   1          while (time >=0)                    // wait for ADC to be fully powered on
  105   1          time--;
  106   1      }
  107          
ARM COMPILER V2.42,  main                                                                  09/01/06  14:41:41  PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN NUMBER (__startup)



*** PUBLICS:
 PUBLIC         start_conversion?T
 PUBLIC         senddata?T
 PUBLIC         hex2ascii?T
 PUBLIC         ADCpoweron?T
 PUBLIC         main



*** CODE SEGMENT '?PR?main?main':
   28: int main(){
 00000000  B500      PUSH        {LR}
   29:     ADCpoweron(20000);                      //Power on ADC
 00000002  4800      LDR         R0,=0x4E20
 00000004  F7FF      BL          ADCpoweron?T  ; T=0x0001  (1)
 00000006  FFFC      BL          ADCpoweron?T  ; T=0x0001  (2)
   31:     ADCCP = 0x00;                           //Select ADC channel 0
 00000008  2100      MOV         R1,#0x0
 0000000A  4800      LDR         R0,=0xFFFF0504
 0000000C  6001      STR         R1,[R0,#0x0]
   32:     REFCON = 0x01;                          //Internal 2.5V reference. 2.5V on Vref pin
 0000000E  2201      MOV         R2,#0x1
 00000010  4800      LDR         R0,=0xFFFF048C
 00000012  6002      STR         R2,[R0,#0x0]
   34:     GP1CON = 0x011;                         // Setup tx & rx pins on P1.0 and P1.1
 00000014  2311      MOV         R3,#0x11
 00000016  4800      LDR         R0,=0xFFFFF404
 00000018  6003      STR         R3,[R0,#0x0]
   35:     GP0CON = 0x220;                         // ext mem mode for BHE & BLE
 0000001A  4B88      LDR         R3,=0x220
 0000001C  4800      LDR         R0,=0xFFFFF400
 0000001E  6003      STR         R3,[R0,#0x0]
   36:     GP2CON = 0x22222220;
 00000020  4800      LDR         R3,=0x22222220
 00000022  4800      LDR         R0,=0xFFFFF408
 00000024  6003      STR         R3,[R0,#0x0]
   37:     GP3CON = 0x22222222;
 00000026  4800      LDR         R3,=0x22222222
 00000028  4800      LDR         R0,=0xFFFFF40C
 0000002A  6003      STR         R3,[R0,#0x0]
   38:     GP4CON = 0x22222222;
 0000002C  4800      LDR         R0,=0xFFFFF410
 0000002E  6003      STR         R3,[R0,#0x0]
   40:     XMCFG = 0x1;
 00000030  4800      LDR         R0,=0xFFFFF000
 00000032  6002      STR         R2,[R0,#0x0]
   41:     XM0CON = 0x3;                           // enable ext mem in 16-bit mode
 00000034  2203      MOV         R2,#0x3
 00000036  4800      LDR         R0,=0xFFFFF010
 00000038  6002      STR         R2,[R0,#0x0]
   42:     XM0PAR = 0x70FF;
 0000003A  4800      LDR         R2,=0x70FF
 0000003C  4800      LDR         R0,=0xFFFFF020
 0000003E  6002      STR         R2,[R0,#0x0]
   44:     COMCON0 = 0x80;                         //Setting DLAB
 00000040  2280      MOV         R2,#0x80
 00000042  4800      LDR         R0,=0xFFFF070C
 00000044  6002      STR         R2,[R0,#0x0]
   45:     COMDIV0 = 0x88;                         //9600bps       
 00000046  2288      MOV         R2,#0x88
 00000048  4800      LDR         R0,=0xFFFF0700
 0000004A  6002      STR         R2,[R0,#0x0]
ARM COMPILER V2.42,  main                                                                  09/01/06  14:41:41  PAGE 4   

   46:     COMDIV1 = 0x00;                                      
 0000004C  4800      LDR         R0,=0xFFFF0704
 0000004E  6001      STR         R1,[R0,#0x0]
   47:     COMCON0 = 0x07;                         //Clearing DLAB
 00000050  2107      MOV         R1,#0x7
 00000052  4800      LDR         R0,=0xFFFF070C
 00000054  6001      STR         R1,[R0,#0x0]
   49:     while(1){
 00000056          L_3:
   50:         start_conversion();
 00000056  F7FF      BL          start_conversion?T  ; T=0x0001  (1)
 00000058  FFD3      BL          start_conversion?T  ; T=0x0001  (2)
   51:     }
 0000005A  E7FC      B           L_3  ; T=0x00000056
   52: }
 0000005C  BC08      POP         {R3}
 0000005E  4718      BX          R3
 00000060          ENDP ; 'main'


*** CODE SEGMENT '?PR?start_conversion?T?main':
   55: void start_conversion(void){
 00000000  B530      PUSH        {R4-R5,LR}
 00000002            ; SCOPE-START
   58:     data_ptr = (unsigned short *)0x10000000;
 00000002  4800      LDR         R5,=0x10000000
 00000004  ---- Variable 'data_ptr' assigned to Register 'R5' ----
   60:     ADCCON = 0x6E4;                         //Start continuous conversion           

⌨️ 快捷键说明

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