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

📄 wdt_selfcalibration.lst

📁 为了更好的利用LPC900系列单片机的系统时钟
💻 LST
字号:
C51 COMPILER V7.02b   WDT_SELFCALIBRATION                                                  08/01/2007 17:38:35 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE WDT_SELFCALIBRATION
OBJECT MODULE PLACED IN WDT_SelfCalibration.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE WDT_SelfCalibration.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          // wdt_selfcalibration.c
   2          // Software sample: Watchdog Timer Self-Calibration
   3          // Christian Kulig, 10/28/02
   4          
   5          // This sample shows how to take advantage of the sophisticated clock tree of the LPC900.
   6          // In order to reduce power consumption and to save the external crystal, it clocks
   7          // the microcontroller with the internal watchdog timer oscillator (WDT).
   8          // The actual application is to communicate with the PC using the serial interface (UART).
   9          // It waits for a command from the PC and sends some data back.
  10          // Since the UART needs a clock with an accuracy better than 2.5% and the watchdog timers
  11          // frequency is stable but unknown in absolute value, it has to be calibrated in advance.
  12          // The very first time the device is powered up, it calibrates the watchdog timer
  13          // and saves the result to EEPROM. After that it selects the WDT as the clock source
  14          // and executes a software reset.
  15          // From then on, on every powerup this calibration is skipped and the actual application 
  16          // is executed. It reads the result of the calibration from the EEPROM and sets up the
  17          // UART according to this value.
  18          
  19          // To test this sample, connect the evaluation board to a com port of the PC.
  20          // Start the program 'Hyperterminal', and set it up as follows:
  21          // 9600 baud, 8 data bits, 1 stop bit and no flow control.
  22          // Click on 'Waiting for Call' and power up the LPC900.
  23          // It should start blinking and wait for a command entered.
  24          // After pressing 'S' the LPC900 sends out data, which are displayed in Hyperterminal.
  25          
  26          // This sample demonstrates the setup and usage of the following functionalities:
  27          // -Watchdog Timer Oscillator
  28          // -Interrupt system
  29          // -Standard Timer 
  30          // -UART and internal baud rate generator (BRG)
  31          // -In-application programming (IAP)
  32          // -Data EEPROM
  33          // -I/O ports
  34          
  35          #include <Reg932.h>
  36          #include "wdt_selfcalibration.h"
  37           
  38          unsigned char dat[]="ABCDEFGHIJ";       // Data to send
  39          unsigned char calStat=0;                        // state of calibration
  40          
  41          void main(void)
  42          {
  43   1              init();                                                 // initialize the I/O ports
  44   1              UART_init();                                    // read the EEPROM and set up the UART
  45   1              WDcal();                                                // call calibration state machine
  46   1              EA=1;
  47   1              while(1)                                
  48   1              { 
  49   2                      P2=0x00;                                        // blink the value of BRGR0 on port P2
  50   2                      msec(5);
  51   2                      P2=BRGR0;                                       
  52   2                      msec(5);                                        
  53   2                      if (sendRQ)                                     // if 'S' was pressed
  54   2                      {
  55   3                              sendtoPC(dat);                  // send out data to PC
C51 COMPILER V7.02b   WDT_SELFCALIBRATION                                                  08/01/2007 17:38:35 PAGE 2   

  56   3                              sendRQ=0;                               // clear send request flag
  57   3                      }
  58   2              }
  59   1      }
  60          
  61          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     48    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     12    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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