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

📄 wakeuptimer.lst

📁 ADuC7020/26是ADI模拟公司开发的ARM7TDMI内核
💻 LST
📖 第 1 页 / 共 2 页
字号:
ARM COMPILER V2.40c,  WakeUpTimer                                                          10/10/05  16:57:03  PAGE 1   


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

stmt  level    source

    1          /*********************************************************************
    2          
    3           Author        : ADI - Apps            www.analog.com/MicroConverter
    4          
    5           Date          : Sept. 2005
    6          
    7           File          : WakeUpTimer.c
    8          
    9           Hardware      : Applicable to ADuC702x rev H or I silicon
   10                           Currently targetting ADuC7026.
   11          
   12           Description   : Wake-up Timer causes part to power-up, perform an Analog 
   13                           to Digital Conversion, output conversion via UART at 9600bps 
   14                           and power-down again, once every minute. 
   15          
   16                           the debugger cannot be used when the part is placed in power down mode.
   17          
   18                  
   19          *********************************************************************/
   20          
   21          #include <ADuC7026.h>
   22          
   23          void IRQ_Handler(void) __irq;
   24          void senddata(short);
   25          void ADCpoweron(int);
   26          char hex2ascii(char);
   27          
   28          int main(void)
   29          {
   30   1          GP4DAT = 0x04000000;            //  Configure P4.2 as output
   31   1          GP4DAT ^= 0x00040000;           // Compliment P4.2  
   32   1              
   33   1          // Setup tx & rx pins on P1.0 and P1.1
   34   1          GP1CON = 0x011;
   35   1          
   36   1          // Start setting up UART
   37   1          COMCON0 = 0x80;             // Setting DLAB
   38   1          COMDIV0 = 0x88;             // 
   39   1          COMDIV1 = 0x00;
   40   1          COMCON0 = 0x07;             // Clearing DLAB
   41   1      
   42   1      
   43   1          T2CON = 0xE8;                   // Configures Timer2 to count down, with 
   44   1                                          // "Hr:Min:Sec:Hundredths" format and prescalar of 256
   45   1      
   46   1          T2LD = 0x00010000;              // Sets the counter register to 5 minutes. Format: HH:MM:SS:hh
   47   1          
   48   1      
   49   1          IRQEN = WAKEUP_TIMER_BIT;               //  Enable ADC IRQ ( 0x10 )
   50   1      
   51   1      
   52   1          // Powering Down Device 
   53   1      /*  POWKEY1 = 0x01;
   54   1          POWCON = 0x30;
   55   1          POWKEY2 = 0xF4;
   56   1      */  
   57   1          return 0;
   58   1      }
   59          
ARM COMPILER V2.40c,  WakeUpTimer                                                          10/10/05  16:57:03  PAGE 2   

   60          
   61          /********************************************************************/
   62          /*                                                                  */
   63          /*      Interrupt Service Rountine                                  */
   64          /*                                                                  */
   65          /********************************************************************/
   66          
   67          void IRQ_Handler() __irq
   68          {
   69   1          int t;
   70   1      
   71   1          GP4DAT ^= 0x00040000;           // Compliment P4.2 each time an interrupt 
   72   1                                          // occurs (light on during conversion)  
   73   1          
   74   1          //ADC configuration
   75   1          ADCpoweron(20000);              // power on ADC                                     
   76   1          REFCON = 0x01;                  // connect internal 2.5V reference to VREF pin
   77   1          ADCCP  = 0x00;                  // Selecting ADC Channel 0  
   78   1          ADCCON = 0x4E3;                 // Perform single software conversion (AC Speed = 1 MSPS)
   79   1          
   80   1          while (!ADCSTA){}           // wait for end of conversion
   81   1              senddata(ADCDAT >> 16); // Output Conversion
   82   1      
   83   1          ADCCON = 0x00;                  // Powers Down ADC
   84   1      
   85   1          t = 5000;                    // Delay required to send data via UART
   86   1          while(t>0)
   87   1          {
   88   2              t--;
   89   2          }
   90   1      
   91   1          GP4DAT ^= 0x00040000;           // Complement P4.2 at end of conversion (switches off)
   92   1      
   93   1          T2CLRI = 0xFF;    // Clearing Timer2 Interrupt
   94   1      
   95   1          // Powering Down Device 
   96   1      /*  POWKEY1 = 0x01;
   97   1          POWCON = 0x30;
   98   1          POWKEY2 = 0xF4;
   99   1      */
  100   1          return;
  101   1      }
  102          
  103          
  104          
  105          
  106          
  107          void ADCpoweron(int time)
  108          {
  109   1          ADCCON = 0x20;                      // power-on the ADC
  110   1          while (time >=0)                    // wait for ADC to be fully powered on
  111   1          time--;
  112   1      }
  113          
  114          
  115          void senddata(short to_send)
  116          {
  117   1          while(!(0x020==(COMSTA0 & 0x020))){}
  118   1              COMTX = 0x0A;                       // output LF 
  119   1          while(!(0x020==(COMSTA0 & 0x020))){}
  120   1              COMTX = 0x0D;                       // output CR 
  121   1          while(!(0x020==(COMSTA0 & 0x020))){}
  122   1              COMTX = hex2ascii ((to_send >> 8) & 0x0F);
  123   1          while(!(0x020==(COMSTA0 & 0x020))){}
  124   1              COMTX = hex2ascii ((to_send >> 4) & 0x0F);                      
  125   1          while(!(0x020==(COMSTA0 & 0x020))){}
ARM COMPILER V2.40c,  WakeUpTimer                                                          10/10/05  16:57:03  PAGE 3   

  126   1              COMTX = hex2ascii (to_send & 0x0F); 
  127   1      }
  128          
  129          
  130          
  131          char hex2ascii(char toconv)
  132          {
  133   1          if (toconv<0x0A) 
  134   1          {
  135   2              toconv += 0x30;
  136   2          }
  137   1          else 
  138   1          {
  139   2              toconv += 0x37;
  140   2          }   
  141   1          return (toconv);
  142   1      }
ARM COMPILER V2.40c,  WakeUpTimer                                                          10/10/05  16:57:03  PAGE 4   

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN NUMBER (__startup)



*** PUBLICS:
 PUBLIC         IRQ_Handler?A
 PUBLIC         IRQ_Handler?T
 PUBLIC         senddata?A
 PUBLIC         senddata?T
 PUBLIC         ADCpoweron?A
 PUBLIC         ADCpoweron?T
 PUBLIC         hex2ascii?A
 PUBLIC         hex2ascii?T
 PUBLIC         main



*** CODE SEGMENT '?PR?main?WakeUpTimer':
   28: int main(void)
 00000000  E92D4000  STMDB       R13!,{LR}
   30:     GP4DAT = 0x04000000;            //  Configure P4.2 as output
 00000004  E3A01301  MOV         R1,#0x4000000
 00000008  E5100000  LDR         R0,=0xFFFFF460
 0000000C  E5801000  STR         R1,[R0,#0x0]
   31:     GP4DAT ^= 0x00040000;           // Compliment P4.2  
 00000010  E5100000  LDR         R0,=0xFFFFF460
 00000014  E5901000  LDR         R1,[R0,#0x0]
 00000018  E2211701  EOR         R1,R1,#0x40000
 0000001C  E5801000  STR         R1,[R0,#0x0]
   34:     GP1CON = 0x011;
 00000020  E3A01011  MOV         R1,#0x11
 00000024  E5100000  LDR         R0,=0xFFFFF404
 00000028  E5801000  STR         R1,[R0,#0x0]
   37:     COMCON0 = 0x80;             // Setting DLAB
 0000002C  E3A01080  MOV         R1,#0x80
 00000030  E5100000  LDR         R0,=0xFFFF070C
 00000034  E5801000  STR         R1,[R0,#0x0]
   38:     COMDIV0 = 0x88;             // 
 00000038  E3A01088  MOV         R1,#0x88
 0000003C  E5100000  LDR         R0,=0xFFFF0700
 00000040  E5801000  STR         R1,[R0,#0x0]
   39:        COMDIV1 = 0x00;
 00000044  E3A01000  MOV         R1,#0x0
 00000048  E5100000  LDR         R0,=0xFFFF0704
 0000004C  E5801000  STR         R1,[R0,#0x0]
   40:        COMCON0 = 0x07;              // Clearing DLAB
 00000050  E3A01007  MOV         R1,#0x7
 00000054  E5100000  LDR         R0,=0xFFFF070C
 00000058  E5801000  STR         R1,[R0,#0x0]
   43:     T2CON = 0xE8;                   // Configures Timer2 to count down, with 
 0000005C  E3A010E8  MOV         R1,#0xE8
 00000060  E5100000  LDR         R0,=0xFFFF0348
 00000064  E5801000  STR         R1,[R0,#0x0]
   46:     T2LD = 0x00010000;              // Sets the counter register to 5 minutes. Format: HH:MM:SS:hh
 00000068  E3A01801  MOV         R1,#0x10000
 0000006C  E5100000  LDR         R0,=0xFFFF0340
 00000070  E5801000  STR         R1,[R0,#0x0]
   49:     IRQEN = WAKEUP_TIMER_BIT;               //  Enable ADC IRQ ( 0x10 )
 00000074  E3A01010  MOV         R1,#0x10
 00000078  E5100000  LDR         R0,=0xFFFF0008
 0000007C  E5801000  STR         R1,[R0,#0x0]
   57:     return 0;
 00000080  E3A00000  MOV         R0,#0x0

⌨️ 快捷键说明

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