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

📄 mcu.lst

📁 nRF24L01和nRF24LU1开发包。在C51和S12上实现。
💻 LST
字号:
C51 COMPILER V8.08   MCU                                                                   01/02/2009 11:50:57 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE MCU
OBJECT MODULE PLACED IN .\obj\mcu.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE l01_bfb\mcu.c LARGE OMF2 OPTIMIZE(9,SPEED) BROWSE INCDIR(l01_bfb;..\..\..\a
                    -rch\hal\include) DEFINE(nRF24L01__) DEBUG PRINT(.\lst\mcu.lst) OBJECT(.\obj\mcu.obj)

line level    source

   1          /* Copyright (c) 2007 Nordic Semiconductor. All Rights Reserved.
   2           *
   3           * The information contained herein is property of Nordic Semiconductor ASA.
   4           * Terms and conditions of usage are described in detail in NORDIC
   5           * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
   6           *
   7           * Licensees are granted free, non-transferable use of the information. NO
   8           * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
   9           * the file.
  10           *
  11           * $LastChangedRevision: 2311 $
  12           */ 
  13           
  14          /** @file
  15           * @ingroup L01
  16           * Implementation of C8051F320 hardware functions. This file implements the
  17           * system_init() function, that sets up hardware such as internal clocks,
  18           * timers, and IO ports.
  19           *
  20           * @author Per Kristian Schanke
  21           */
  22           
  23          //#include "fap.h"
  24          #include <Cygnal\c8051f320.h>
  25          #include "stdint.h"
  26          #include "stdbool.h"
  27          #include "system.h"
  28          
  29          static void sysclk_init(void);
  30          static void port_init(void);
  31          extern void hal_spi_init(uint8_t spi_speed);
  32          
  33          //-----------------------------------------------------------------------------
  34          // Definitions
  35          //-----------------------------------------------------------------------------
  36          
  37          // USB clock selections (SFR CLKSEL)
  38          #define USB_4X_CLOCK       0x00         // Select 4x clock multiplier, for USB
  39          
  40          // System clock selections (SFR CLKSEL)
  41          #define SYS_INT_OSC        0x00         // Select to use internal oscillator
  42          
  43          //-----------------------------------------------------------------------------
  44          // Global Variable Declarations
  45          //-----------------------------------------------------------------------------
  46          
  47          void system_init (void)
  48          {
  49   1        uint16_t temp;
  50   1      
  51   1        PCA0MD &= ~0x40;              // Disable Watchdog timer
  52   1      
  53   1        REG0CN |= 0x80;               // Internal Voltage Regulator Disabled
  54   1      
C51 COMPILER V8.08   MCU                                                                   01/02/2009 11:50:57 PAGE 2   

  55   1        sysclk_init();                // initialize system clock
  56   1        
  57   1        port_init();                  // configure cross bar
  58   1       
  59   1        TCON |= 0x01;                 // Int1 level triggered  xxx same as ir0 = 1
  60   1      
  61   1        // Radio IRQ setup
  62   1        IT0 = 1;                      // /INT0, edge sens    
  63   1        IE0 = 0;                      // clear pending interrupt  
  64   1        EX0 = 0;                      // Extern interrupt0 (nRF) enabled  
  65   1       
  66   1         // PS2 IRQ setup
  67   1        IT1 = 1;                      // Int1 edge sens
  68   1        IE1 = 0;
  69   1        EX1 = 0;                      // PS2 IRQ
  70   1        PX1=1;                        // Int1 priority bit set (ps2)    
  71   1        
  72   1        hal_spi_init(0);              // SPI Init, 3-wire mode, CK/2 speed
  73   1      
  74   1        temp=0xffff;                  // Waiting ...  
  75   1        while(--temp)                 // nRF radio is booting up
  76   1          ;                           // temp value can be tuned.
  77   1      }
  78          
  79          void sysclk_init (void)
  80          {
  81   1      #ifdef _USB_LOW_SPEED_
                
                OSCICN |= 0x03;                       // Configure internal oscillator for
                                                      // its maximum frequency and enable
                                                      // missing clock detector
                
                CLKSEL  = SYS_EXT_OSC;                // Select System clock
                CLKSEL |= USB_INT_OSC_DIV_2;          // Select USB clock
              #else
  90   1        OSCICN |= 0x03;                       // Configure internal oscillator for
  91   1                                              // its maximum frequency and enable
  92   1                                              // missing clock detector
  93   1        
  94   1        CLKMUL  = 0x00;                       // Select internal oscillator as
  95   1                                              // input to clock multiplier
  96   1        
  97   1        CLKMUL |= 0x80;                       // Enable clock multiplier
  98   1        
  99   1        delay_100ms();                       // Delay for clock multiplier to begin
 100   1        
 101   1        CLKMUL |= 0xC0;                       // Initialize the clock multiplier
 102   1        
 103   1        while(!(CLKMUL & 0x20))               // Wait for multiplier to lock
 104   1          ;
 105   1        CLKSEL  = SYS_INT_OSC;                // Select system clock
 106   1        CLKSEL |= USB_4X_CLOCK;               // Select USB clock
 107   1      #endif  /* _USB_LOW_SPEED_ */
 108   1      }
 109          
 110          void port_init (void)
 111          {
 112   1        P0MDIN = 0xff;                        // Port 0 set as digital IO
 113   1        P1MDIN = 0xff;                        // Port 1 set as digital IO
 114   1        P2MDIN = 0xff;                        // Port 2 set as digital IO
 115   1      
 116   1        P0MDOUT = 0x8D;                       // P0.0(SCK), P0.2(MOSI), P0.3(CSN), P0.4(CE) Outputs, P0.5(IRQ) r
C51 COMPILER V8.08   MCU                                                                   01/02/2009 11:50:57 PAGE 3   

             -est inputs
 117   1        P1MDOUT = 0x63;                       // P1.0(LED1), P1.1(LED2), P1.2(LED3), P1.3(LED4) Outputs, rest in
             -puts
 118   1        P2MDOUT = 0x00;                       // P2.1(SW1), P2.2(SW2), P2.3(SW3), P2[7..4] Rotary Switch, Inputs
 119   1      
 120   1        P0 = 0x6A;                            // P0.3(CSN), P0.5(IRQ) High(pullups), rest low
 121   1        P1 = 0x7F;                            // P1[3..0] LEDS OFF
 122   1        P2 = 0xff;                            // P2[3..1] low(ext.pullups), P2[7..4] pullups
 123   1      
 124   1        XBR0 = 0x00;                          // No periferi routed to crossbar
 125   1        XBR1 |= 0x40;                         // Enable Crossbar
 126   1        IT01CF = 0x65;                        // Int0 assigned to P0.5 and Int1 assigned to P0.6
 127   1                                              // Both active low 
 128   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    108    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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