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

📄 main.lst

📁 掏美元培训得来的某外国公司推广keil ARM 和LPC2100的源码。
💻 LST
字号:
ARM COMPILER V2.00f,  main                                                                 20/02/05  11:46:10  PAGE 1   


ARM COMPILER V2.00f, COMPILATION OF MODULE main
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe main.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG TABS(4) 

stmt  level    source

    1          /************************************************************/
    2          /* PROJECT NAME: PWM                                        */
    3          /* Project:      LPC2100 Training course                    */
    4          /* Engineer:     T Martin                                   */
    5          /* Filename:     main.c                                     */
    6          /* Language:     C                                          */
    7          /* Compiler:     Keil Carm 2.00b                            */
    8          /* Assembler:                                               */
    9          /*                                                          */
   10          /************************************************************/
   11          /* Modification History:                                    */
   12          /*                                                          */
   13          /************************************************************/
   14          /* Function:                                                */
   15          /*                                                          */
   16          /* Example PWM module program for LPC2100                   */
   17          /*                                                          */
   18          /* Demonstrates dual edge PWM generation                    */
   19          /*                                                          */  
   20          /* Oscillator frequency 12.000 Mhz                          */
   21          /* Target board Keil MCB2100                                */
   22          /************************************************************/
   23          
   24          #include <LPC21XX.H>
   25          
   26          
   27            
   28          
   29          
   30          int main(void)
   31          {
   32   1      unsigned int val,delay;
   33   1      
   34   1      PINSEL0 |= 0x00028000;  //Enable pin 0.7   as PWM2 
   35   1      PWMPR    = 0x00000001;  //Load prescaler
   36   1      
   37   1      PWMPCR = 0x0000404;     //PWM channel 2 double edge control, output enabled
   38   1      PWMMCR = 0x00000003;    //On match with timer reset the counter
   39   1      PWMMR0 = 0x000000FF;    //set cycle rate to sixteen ticks
   40   1      PWMMR1 = 0x00000080;    //set rising edge of PWM2 to 2 ticks
   41   1      PWMMR2 = 0x00000080;    //set falling edge of PWM2 to 8 ticks
   42   1      PWMLER = 0x00000007;    //enable shadow latch for match 0 - 2 
   43   1      PWMEMR = 0x00000280;    //Match 1 and Match 2 outputs set high
   44   1      PWMTCR = 0x00000002;    //Reset counter and prescaler 
   45   1      PWMTCR = 0x00000009;    //enable counter and PWM, release counter from reset
   46   1      
   47   1      ADCR   = 0x00250601;    // Setup A/D: 10-bit AIN0 @ 3MHz 
   48   1      ADCR  |= 0x01000000;    // Start A/D Conversion 
   49   1      
   50   1      while(1)                // main loop
   51   1      {
   52   2      for (delay=0;delay < 0x100;delay++)
   53   2      {
   54   3      ;
   55   3      }
   56   2      do
   57   2      {
   58   3          val = ADDR;                         // Read A/D Data Register 
   59   3      }        
ARM COMPILER V2.00f,  main                                                                 20/02/05  11:46:10  PAGE 2   

   60   2      while ((val & 0x80000000) == 0);        //Wait for the conversion to complete
   61   2      val = ((val >> 8) & 0x00FF);            //Extract the A/D result 
   62   2      
   63   2      PWMMR1 = 0x00000000+val;                 //Modulate PWM
   64   2      PWMMR2 = 0x000000FF-val;
   65   2      PWMLER = 0x00000006;                     //set latch to update PWM registers next cycle
   66   2      }
   67   1      
   68   1      
   69   1      }
   70          
   71          
   72          
ARM COMPILER V2.00f,  main                                                                 20/02/05  11:46:10  PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN NUMBER (__startup)



*** PUBLICS:
 PUBLIC         main



*** CODE SEGMENT '?PR?main?main':
   30: int main(void)
 00000000  B500      PUSH        {LR}
   31: {
 00000002            ; SCOPE-START
   34: PINSEL0 |= 0x00028000;  //Enable pin 0.7   as PWM2 
 00000002  4800      LDR         R2,=0x28000
 00000004  4800      LDR         R0,=0xE002C000
 00000006  6801      LDR         R1,[R0,#0x0]
 00000008  4311      ORR         R1,R2
 0000000A  6001      STR         R1,[R0,#0x0]
   35: PWMPR      = 0x00000001;  //Load prescaler
 0000000C  2101      MOV         R1,#0x1
 0000000E  4800      LDR         R0,=0xE001400C
 00000010  6001      STR         R1,[R0,#0x0]
   37: PWMPCR = 0x0000404;     //PWM channel 2 double edge control, output enabled
 00000012  4800      LDR         R1,=0x404
 00000014  4800      LDR         R0,=0xE001404C
 00000016  6001      STR         R1,[R0,#0x0]
   38: PWMMCR = 0x00000003;    //On match with timer reset the counter
 00000018  2103      MOV         R1,#0x3
 0000001A  4800      LDR         R0,=0xE0014014
 0000001C  6001      STR         R1,[R0,#0x0]
   39: PWMMR0 = 0x000000FF;    //set cycle rate to sixteen ticks
 0000001E  21FF      MOV         R1,#0xFF
 00000020  4800      LDR         R0,=0xE0014018
 00000022  6001      STR         R1,[R0,#0x0]
   40: PWMMR1 = 0x00000080;    //set rising edge of PWM2 to 2 ticks
 00000024  2180      MOV         R1,#0x80
 00000026  4800      LDR         R0,=0xE001401C
 00000028  6001      STR         R1,[R0,#0x0]
   41: PWMMR2 = 0x00000080;    //set falling edge of PWM2 to 8 ticks
 0000002A  2180      MOV         R1,#0x80
 0000002C  4800      LDR         R0,=0xE0014020
 0000002E  6001      STR         R1,[R0,#0x0]
   42: PWMLER = 0x00000007;    //enable shadow latch for match 0 - 2 
 00000030  2107      MOV         R1,#0x7
 00000032  4800      LDR         R0,=0xE0014050
 00000034  6001      STR         R1,[R0,#0x0]
   43: PWMEMR = 0x00000280;    //Match 1 and Match 2 outputs set high
 00000036  49A0      LDR         R1,=0x280
 00000038  4800      LDR         R0,=0xE001403C
 0000003A  6001      STR         R1,[R0,#0x0]
   44: PWMTCR = 0x00000002;    //Reset counter and prescaler 
 0000003C  2102      MOV         R1,#0x2
 0000003E  4800      LDR         R0,=0xE0014004
 00000040  6001      STR         R1,[R0,#0x0]
   45: PWMTCR = 0x00000009;    //enable counter and PWM, release counter from reset
 00000042  2109      MOV         R1,#0x9
 00000044  4800      LDR         R0,=0xE0014004
 00000046  6001      STR         R1,[R0,#0x0]
   47: ADCR   = 0x00250601;    // Setup A/D: 10-bit AIN0 @ 3MHz 
 00000048  4800      LDR         R1,=0x250601
 0000004A  4800      LDR         R0,=0xE0034000
 0000004C  6001      STR         R1,[R0,#0x0]
   48: ADCR  |= 0x01000000;    // Start A/D Conversion 
 0000004E  4800      LDR         R2,=0x1000000
ARM COMPILER V2.00f,  main                                                                 20/02/05  11:46:10  PAGE 4   

 00000050  4800      LDR         R0,=0xE0034000
 00000052  6801      LDR         R1,[R0,#0x0]
 00000054  4311      ORR         R1,R2
 00000056  6001      STR         R1,[R0,#0x0]
   52: for (delay=0;delay < 0x100;delay++)
 00000058          L_9:
 00000058  2000      MOV         R0,#0x0
 0000005A  ---- Variable 'delay' assigned to Register 'R0' ----
   55: }
 0000005A          L_5:
 0000005A  3001      ADD         R0,#0x1
 0000005C  4940      LDR         R1,=0x100
 0000005E  4288      CMP         R0,R1 ; delay
 00000060  D3FB      BCC         L_5  ; T=0x0000005A
   56: do
 00000062          L_10:
   58:     val = ADDR;                         // Read A/D Data Register 
 00000062  4800      LDR         R0,=0xE0034004
 00000064  6800      LDR         R0,[R0,#0x0]
 00000066  ---- Variable 'val' assigned to Register 'R0' ----
   59: }        
 00000066  4800      LDR         R1,=0x80000000
 00000068  4208      TST         R0,R1 ; val
 0000006A  D0FA      BEQ         L_10  ; T=0x00000062
   61: val = ((val >> 8) & 0x00FF);            //Extract the A/D result 
 0000006C  0A00      LSR         R0,R0,#0x8 ; val
 0000006E  21FF      MOV         R1,#0xFF
 00000070  4008      AND         R0,R1
   63: PWMMR1 = 0x00000000+val;                 //Modulate PWM
 00000072  1C02      MOV         R2,R0 ; val
 00000074  4800      LDR         R1,=0xE001401C
 00000076  600A      STR         R2,[R1,#0x0]
   64: PWMMR2 = 0x000000FF-val;
 00000078  21FF      MOV         R1,#0xFF
 0000007A  1A09      SUB         R1,R0 ; val
 0000007C  4800      LDR         R0,=0xE0014020
 0000007E  6001      STR         R1,[R0,#0x0]
   65: PWMLER = 0x00000006;                     //set latch to update PWM registers next cycle
 00000080  2106      MOV         R1,#0x6
 00000082  4800      LDR         R0,=0xE0014050
 00000084  6001      STR         R1,[R0,#0x0]
   66: }
 00000086  E7E7      B           L_9  ; T=0x00000058
 00000088            ; SCOPE-END
 00000088  BC08      POP         {R3}
 0000008A  4718      BX          R3
 0000008C          ENDP ; 'main'



Module Information          Static
----------------------------------
  code size            =    ------
  data size            =    ------
  const size           =    ------
End of Module Information.


ARM COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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