Initial.LST
上传用户:gxz1972
上传日期:2019-09-13
资源大小:323k
文件大小:9k
- C51 COMPILER V7.02b INITIAL 11/30/2007 14:07:11 PAGE 1
- C51 COMPILER V7.02b, COMPILATION OF MODULE INITIAL
- OBJECT MODULE PLACED IN Initial.OBJ
- COMPILER INVOKED BY: C:KeilC51BINc51.exe Initial.c DB OE
- stmt level source
- 1 //-----------------------------------------------------------------------------
- 2 // GlobalVariabel.c
- 3 //-----------------------------------------------------------------------------
- 4 // Copyright 2007 Vson Technology, Inc.
- 5 // http://www.usbmcu.com
- 6 //
- 7 // Program Description:
- 8 //
- 9 //
- 10 //
- 11 //
- 12 //
- 13 // MCU: C8051F347
- 14 // Tool chain: Keil C51 7.50 / Keil EVAL C51
- 15 // Silicon Laboratories IDE version 2.6
- 16 // Command Line:
- 17 // Project Name: TR1000
- 18 //
- 19 //
- 20 // Release 1.0
- 21 // -All changes by Brin
- 22 // -24 JUL 2007
- 23 //
- 24 //
- 25
- 26 //-----------------------------------------------------------------------------
- 27 // Includes
- 28 //-----------------------------------------------------------------------------
- 29
- 30 #include "Include_H.h"
- 31
- 32
- 33 //-----------------------------------------------------------------------------
- 34 // Initialization Subroutines
- 35 //-----------------------------------------------------------------------------
- 36
- 37 void Initial(void)
- 38 {
- 39 1 data BYTE i;
- 40 1 PORT_Init (); // Initialize Crossbar and GPIO
- 41 1 Timer_Init();
- 42 1 SYSCLK_Init (); // Initialize oscillator
- 43 1 USB0_Init (); // Initialize USB0
- 44 1 VDD_MON_Init(); // Turn on VDD Monitor
- 45 1
- 46 1 for (i = 0; i < 64; i++)
- 47 1 {
- 48 2 gaucTxData2HostBuffer[i]=0;
- 49 2 }
- 50 1 }
- 51 //-----------------------------------------------------------------------------
- 52 // SYSCLK_Init
- 53 //-----------------------------------------------------------------------------
- 54 //
- 55 // Return Value : None
- C51 COMPILER V7.02b INITIAL 11/30/2007 14:07:11 PAGE 2
- 56 // Parameters : None
- 57 //
- 58 // This function initializes the system clock and USB clock.
- 59 //
- 60 //-----------------------------------------------------------------------------
- 61
- 62 void SYSCLK_Init (void)
- 63 {
- 64 1 unsigned char delay = 100;
- 65 1
- 66 1 OSCICN |= 0x03; // Configure internal oscillator for
- 67 1 // its maximum frequency
- 68 1
- 69 1 CLKMUL = 0x00; // Select internal oscillator as
- 70 1 // input to clock multiplier
- 71 1
- 72 1 CLKMUL |= 0x80; // Enable clock multiplier
- 73 1 while (delay--); // Delay for >5us
- 74 1 CLKMUL |= 0xC0; // Initialize the clock multiplier
- 75 1
- 76 1 while(!(CLKMUL & 0x20)); // Wait for multiplier to lock
- 77 1
- 78 1 CLKSEL |= USB_4X_CLOCK; // Select USB clock
- 79 1 CLKSEL |= SYS_4X_DIV_2; // Select SYSCLK as Clock Multiplier/2
- 80 1 }
- 81
- 82
- 83
- 84 /*
- 85 void SYSCLK_Init (void) //void Oscillator_Init()
- 86 {
- 87 int i = 0;
- 88 OSCICN = 0x83;
- 89 CLKMUL = 0x80;
- 90 for (i = 0; i < 20; i++); // Wait 5us for initialization
- 91 CLKMUL |= 0xC0;
- 92 while ((CLKMUL & 0x20) == 0);
- 93 CLKSEL = 0x10;
- 94 }
- 95
- 96 */
- 97 //-----------------------------------------------------------------------------
- 98 // VDD_MON_Init
- 99 //-----------------------------------------------------------------------------
- 100 //
- 101 // Return Value : None
- 102 // Parameters : None
- 103 //
- 104 // This function initializes the VDD monitor
- 105 //
- 106 //-----------------------------------------------------------------------------
- 107 void VDD_MON_Init(void)
- 108 {
- 109 1 RSTSRC |= 0x02;
- 110 1 }
- 111
- 112 //-----------------------------------------------------------------------------
- 113 // USB0_Init
- 114 //-----------------------------------------------------------------------------
- 115 //
- 116 // Return Value : None
- 117 // Parameters : None
- C51 COMPILER V7.02b INITIAL 11/30/2007 14:07:11 PAGE 3
- 118 //
- 119 // - Initialize USB0
- 120 // - Enable USB0 interrupts
- 121 // - Enable USB0 transceiver
- 122 // - USB0 left disabled
- 123 //
- 124 //-----------------------------------------------------------------------------
- 125 void USB0_Init (void)
- 126 {
- 127 1 UWRITE_BYTE(POWER, 0x08); // Asynch. reset
- 128 1
- 129 1 UWRITE_BYTE(IN1IE, 0x0F); // Enable Endpoint0 Interrupt
- 130 1 UWRITE_BYTE(OUT1IE, 0x0F);
- 131 1 UWRITE_BYTE(CMIE, 0x04); // Enable Reset interrupt
- 132 1
- 133 1 USB0XCN = 0xC0; // Enable transceiver
- 134 1 USB0XCN |= FULL_SPEED; // Select device speed
- 135 1
- 136 1 UWRITE_BYTE(CLKREC, 0x80); // Enable clock recovery,
- 137 1 // single-step mode disabled
- 138 1
- 139 1 EIE1 |= 0x02; // Enable USB0 Interrupts
- 140 1 }
- 141
- 142
- 143
- 144 //-----------------------------------------------------------------------------
- 145 // PORT_Init
- 146 //-----------------------------------------------------------------------------
- 147 //
- 148 // Return Value : None
- 149 // Parameters : None
- 150 //
- 151 // This function configures the crossbar and GPIO ports.
- 152 //
- 153 // P2.2 digital push-pull LED
- 154 // P2.3 digital push-pull LED
- 155 //
- 156 //-----------------------------------------------------------------------------
- 157 void PORT_Init(void)
- 158 {
- 159 1 P2MDOUT |= 0x0C; // Port 2 pins 0,1 set high impedence
- 160 1 Led1 = 0; // Start with both Leds off
- 161 1 Led2 = 0;
- 162 1 XBR0 = 0x00;
- 163 1 XBR1 = 0x40; // Enable Crossbar
- 164 1 }
- 165
- 166 void Timer_Init(void)
- 167 {
- 168 1 TMOD = 0x21;
- 169 1 CKCON = 0X08; //0x01;
- 170 1 TH1 = 0X30; //0x63;
- 171 1 // TL0 = 0xa0;
- 172 1 TH0 = 0x15;
- 173 1 TCON = 0x50;
- 174 1
- 175 1 TMR2CN = 0x04;
- 176 1 TMR2RLL = 0xDF;
- 177 1 TMR2RLH = 0xB1;
- 178 1 TMR2L = 0xDF;
- 179 1 TMR2H = 0xB1;
- C51 COMPILER V7.02b INITIAL 11/30/2007 14:07:11 PAGE 4
- 180 1
- 181 1 TMR3CN = 0x04;
- 182 1 TMR3RLL = 0xDF;
- 183 1 TMR3RLH = 0xB1;
- 184 1 TMR3L = 0xDF;
- 185 1 TMR3H = 0xB1;
- 186 1
- 187 1 }
- 188
- 189
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 183 ----
- CONSTANT SIZE = ---- ----
- XDATA SIZE = ---- ----
- PDATA SIZE = ---- ----
- DATA SIZE = ---- ----
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)