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

📄 interrupt.lst

📁 lpc2138读写SD卡的fat文件系统
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.00d,  interrupt                                                            23/10/05  18:16:18  PAGE 1   


ARM COMPILER V2.00d, COMPILATION OF MODULE interrupt
OBJECT MODULE PLACED IN .\Flash\interrupt.obj
COMPILER INVOKED BY: C:\KEIL\ARM\BIN\CA.EXE interrupt.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG PRINT(.\FLASH\INTERRUPT.LST
                    -) TABS(4) OBJECT(.\Flash\interrupt.obj) 

stmt  level    source

    1          // Interrupt routines
    2          #include <stdio.h>                  // standard I/O .h-file
    3          #include <LPC213x.H>                // LPC213x definitions
    4          #include <bsp.h>                    // include board support package
    5          
    6          int volatile timeval;
    7          int volatile timeval_0;
    8          int volatile T0_flag;
    9          unsigned int volatile timer_0_capture;
   10          unsigned int volatile timer_0_capture_accum;
   11          unsigned int val;
   12          unsigned int volatile tval;
   13          extern void set_LED (unsigned char led_no, unsigned char led_cmd);
   14          
   15          // Timer Counter 1 Interrupt with (60 MHz CPU)/4 Clock
   16          // Timer 1 also schedules AD readings
   17          void tc1 (void) __irq {
   18   1        if (timeval > 0) --timeval;   // semephore for delay functions
   19   1      // set AD channel to ch1
   20   1        AD0CR   = 0x00200402;         // Setup A/D: 10-bit AIN0 (ch 1) @ 3MHz
   21   1        AD0CR  |= 0x01200000;                 // Start A/D Conversion
   22   1        do {
   23   2          val = AD0DR;                        // Read A/D Data Register
   24   2        } while ((val & 0x80000000) == 0);    // Wait for end of A/D Conversion
   25   1        AD0CR &= ~0x01000000;                 // Stop A/D Conversion
   26   1        val = (val >> 6) & 0x03FF;            // Extract AIN0 Value
   27   1      // let read next AD channel (ch0)
   28   1        AD0CR   = 0x00200401;         // Setup A/D: 10-bit AIN0 (ch 0) @ 3MHz
   29   1        AD0CR  |= 0x01200000;                 // Start A/D Conversion
   30   1        do {
   31   2          tval = AD0DR;                       // Read A/D Data Register
   32   2        } while ((tval & 0x80000000) == 0);   // Wait for end of A/D Conversion
   33   1        AD0CR &= ~0x01000000;                 // Stop A/D Conversion
   34   1        tval = (tval >> 6) & 0x03FF;          // Extract AIN0 Value
   35   1      // clean up interrupt flags
   36   1        T1IR |= 0x11;                 // clear all interrupts
   37   1        VICVectAddr = 0;              // Acknowledge Interrupt
   38   1      }
   39          
   40          // Setup the Timer Counter 1 Interrupt (used for delay function)
   41          void init_timer_1 (void) {
   42   1        T1MR0 = 1874;                 // 0.125uSec = 1875-1 counts    
   43   1        T1MCR = 3;                    // Interrupt and Reset on MR0   
   44   1      // #define T1CCR          (*((volatile unsigned long *) 0xE0008028))
   45   1        T1CCR = 0x05;                 // init control reg.
   46   1        T1TCR = 1;                            // Timer1 Enable
   47   1        VICVectAddr1 = (unsigned long)tc1;    // set interrupt vector in 0
   48   1        VICVectCntl1 = 0x20 | 5;              // use it for Timer 1 Interrupt
   49   1      }
   50          
   51          void delay (int delay_val) {     // Delay function
   52   1        unsigned int cnt;
   53   1        unsigned int val;
   54   1        int diff;
   55   1        timeval = delay_val;          // init timeer 1 value to delay
   56   1        while (timeval > 0);          // wait until Timer 1 decrements delay_val to zero 
   57   1      }
   58          
ARM COMPILER V2.00d,  interrupt                                                            23/10/05  18:16:18  PAGE 2   

   59          // Timer Counter 0 Interrupt executes with 60 MHz CPU Clock
   60          void tc0 (void) __irq {         // Timer 0 is used to measure anonmometer period
   61   1      // Need to determine what caused the interrupt
   62   1      // If capture interrupt then set timer 0 period capture variable
   63   1        if (T0IR==0x10) {
   64   2          set_LED(ONE,ON);
   65   2          T0_flag++;                  // measure one full rev
   66   2          if (T0_flag>4) {
   67   3            timer_0_capture = T0TC;   // get timer counts
   68   3            if (timer_0_capture > 50000000) timer_0_capture = 50000000; // set to lowest speed
   69   3            T0TC = 0;                 // reset counter
   70   3            T0_flag = 0;              // reset flag to measure 4 pulses (1 rev)
   71   3          }
   72   2          T0IR |= 0x10;               // Clear capture interrupt flag
   73   2        } 
   74   1        else if (T0IR==0x01) {        // Is it a match interrupt?                     
   75   2          set_LED(ONE,OFF);           // overflow - no wind
   76   2          timer_0_capture = 50000000; // no conversion, set to lowest speed
   77   2          T0TC = 0;                   // make use counter is reset
   78   2        }
   79   1      
   80   1        T0IR |= 0x11;                 // clear all interrupts
   81   1        VICVectAddr = 0;              // Acknowledge Interrupt
   82   1      }
   83          
   84          // Setup the Timer Counter 0 Interrupt
   85          void init_timer (void) {
   86   1        T0_flag = 0;                  // init flag to measure one rev.
   87   1        T0MR0 = 0x02FFFFFF;           // large duration for no wind
   88   1        T0CCR = 0x05;                 // cause capture on P0.0 
   89   1        T0MCR = 3;                    // Interrupt and Reset on MR0
   90   1        T0TCR = 1;                    // Timer0 Enable
   91   1        VICVectAddr0 = (unsigned long)tc0;    // set interrupt vector in 0
   92   1        VICVectCntl0 = 0x20 | 4;              // use it for Timer 0 Interrupt
   93   1      }
ARM COMPILER V2.00d,  interrupt                                                            23/10/05  18:16:18  PAGE 3   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN CODE16 (set_LED?T)
 EXTERN CODE32 (set_LED?A)



*** PUBLICS:
 PUBLIC         tc1?A
 PUBLIC         init_timer_1?T
 PUBLIC         delay?T
 PUBLIC         tc0?A
 PUBLIC         init_timer?T
 PUBLIC         timeval
 PUBLIC         timeval_0
 PUBLIC         T0_flag
 PUBLIC         timer_0_capture
 PUBLIC         timer_0_capture_accum
 PUBLIC         val
 PUBLIC         tval



*** DATA SEGMENT '?DT0?interrupt':
 00000000          timeval:
 00000000            DS          4
 00000004          timeval_0:
 00000004            DS          4
 00000008          T0_flag:
 00000008            DS          4
 0000000C          timer_0_capture:
 0000000C            DS          4
 00000010          timer_0_capture_accum:
 00000010            DS          4
 00000014          val:
 00000014            DS          4
 00000018          tval:
 00000018            DS          4



*** CODE SEGMENT '?PR?tc1?A?interrupt':
   17: void tc1 (void) __irq {
 00000000  E92D000F  STMDB       R13!,{R0-R3}
   18:   if (timeval > 0) --timeval;   // semephore for delay functions
 00000004  E5100000  LDR         R0,=timeval ; timeval
 00000008  E5900000  LDR         R0,[R0,#0x0] ; timeval
 0000000C  E3500000  CMP         R0,#0x0000
 00000010  DA000003  BLE         L_1  ; Targ=0x24
 00000014  E5100000  LDR         R0,=timeval ; timeval
 00000018  E5901000  LDR         R1,[R0,#0x0] ; timeval
 0000001C  E2411001  SUB         R1,R1,#0x0001
 00000020  E5801000  STR         R1,[R0,#0x0] ; timeval
 00000024          L_1:
   20:   AD0CR   = 0x00200402;         // Setup A/D: 10-bit AIN0 (ch 1) @ 3MHz
 00000024  E5101000  LDR         R1,=0x200402
 00000028  E5100000  LDR         R0,=0xE0034000
 0000002C  E5801000  STR         R1,[R0,#0x0]
   21:   AD0CR  |= 0x01200000;                 // Start A/D Conversion
 00000030  E3A02612  MOV         R2,#0x1200000
 00000034  E5100000  LDR         R0,=0xE0034000
 00000038  E5901000  LDR         R1,[R0,#0x0]
 0000003C  E1811002  ORR         R1,R1,R2
 00000040  E5801000  STR         R1,[R0,#0x0]
   22:   do {
 00000044          L_2:
   23:     val = AD0DR;                        // Read A/D Data Register
 00000044  E5100000  LDR         R0,=0xE0034004
 00000048  E5901000  LDR         R1,[R0,#0x0]
 0000004C  E5100000  LDR         R0,=val ; val
ARM COMPILER V2.00d,  interrupt                                                            23/10/05  18:16:18  PAGE 4   

 00000050  E5801000  STR         R1,[R0,#0x0] ; val
   24:   } while ((val & 0x80000000) == 0);    // Wait for end of A/D Conversion
 00000054  E5100000  LDR         R0,=val ; val
 00000058  E5901000  LDR         R1,[R0,#0x0] ; val
 0000005C  E3A00102  MOV         R0,#0x80000000
 00000060  E1110000  TST         R1,R0
 00000064  0AFFFFF6  BEQ         L_2  ; Targ=0x44
   25:   AD0CR &= ~0x01000000;                 // Stop A/D Conversion
 00000068  E3A03401  MOV         R3,#0x1000000
 0000006C  E5100000  LDR         R0,=0xE0034000
 00000070  E5902000  LDR         R2,[R0,#0x0]
 00000074  E1C22003  BIC         R2,R2,R3
 00000078  E5802000  STR         R2,[R0,#0x0]
   26:   val = (val >> 6) & 0x03FF;            // Extract AIN0 Value
 0000007C  E1A01321  MOV         R1,R1,LSR #6
 00000080  E5100000  LDR         R0,=0x3FF
 00000084  E0011000  AND         R1,R1,R0
 00000088  E5100000  LDR         R0,=val ; val
 0000008C  E5801000  STR         R1,[R0,#0x0] ; val
   28:   AD0CR   = 0x00200401;         // Setup A/D: 10-bit AIN0 (ch 0) @ 3MHz
 00000090  E5101000  LDR         R1,=0x200401
 00000094  E5100000  LDR         R0,=0xE0034000
 00000098  E5801000  STR         R1,[R0,#0x0]
   29:   AD0CR  |= 0x01200000;                 // Start A/D Conversion
 0000009C  E3A02612  MOV         R2,#0x1200000
 000000A0  E5100000  LDR         R0,=0xE0034000
 000000A4  E5901000  LDR         R1,[R0,#0x0]
 000000A8  E1811002  ORR         R1,R1,R2
 000000AC  E5801000  STR         R1,[R0,#0x0]
   30:   do {
 000000B0          L_6:
   31:     tval = AD0DR;                       // Read A/D Data Register
 000000B0  E5100000  LDR         R0,=0xE0034004
 000000B4  E5901000  LDR         R1,[R0,#0x0]
 000000B8  E5100000  LDR         R0,=tval ; tval
 000000BC  E5801000  STR         R1,[R0,#0x0] ; tval
   32:   } while ((tval & 0x80000000) == 0);   // Wait for end of A/D Conversion
 000000C0  E5100000  LDR         R0,=tval ; tval
 000000C4  E5900000  LDR         R0,[R0,#0x0] ; tval

⌨️ 快捷键说明

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