📄 initial.lst
字号:
C51 COMPILER V7.06 INITIAL 06/13/2005 12:55:37 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE INITIAL
OBJECT MODULE PLACED IN Initial.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\c51.exe Initial.c DB OE
stmt level source
1 /*********************************************************************************************************
-*
2 Sincere Techonlogy
3 Shanghai.China
4 (c) Copyright 2005,Sincere Technology,Shanghai China
5 All Rights Reserved
6
7
8
9 File name : Initial.c
10 Author : Neil
11 Description : Include initial functions
12 Target : C8051F023
13 Data : 2005-3
14 **********************************************************************************************************
-/
15
16
17 #include "Include.h"
18
19
20 /********************************************************************************************************
21 --------------------------------------------------------------------------------------------------------
22 void SYSCLK_Init (void)
23 Author : Neil
24 Data : 2005-3
25 --------------------------------------------------------------------------------------------------------
26
27 This routine initializes the system clock to use an over 16MHz crystal
28 as its clock source.
29 *********************************************************************************************************/
30 void SYSCLK_Init (void)
31 {
32 1 int i; // delay counter
33 1
34 1 OSCXCN = 0x67; // start external oscillator with
35 1 for (i = 0; i < 255; i++) ; // wait for osc to start
36 1 while ( (OSCXCN & 0x80) == 0 ); // wait for xtal to stabilize
37 1
38 1
39 1 OSCICN = 0x88; // select external oscillator as SYSCLK
40 1 // source and enable missing clock
41 1 // detector
42 1 }
43
44
45
46
47 /*********************************************************************************************************
48 ---------------------------------------------------------------------------------------------------------
49 void MEMORY_Init (void)
50 Author : Neil
51 Data : 2005-3
52 ---------------------------------------------------------------------------------------------------------
53 This routine initializes the MCU use internal memory only, ALE hight and ALE low
C51 COMPILER V7.06 INITIAL 06/13/2005 12:55:37 PAGE 2
54 pluse width=1 SYSCLK cycle.
55 ********************************************************************************************************/
56 void MEMORY_Init (void)
57 {
58 1 EMI0CF = 0x00; // External Memory Configuration Register
59 1 }
60
61
62
63
64
65 /*********************************************************************************************************
66 ----------------------------------------------------------------------------------------------------------
67 void PERIAL_Init (void)
68 Author : Neil
69 Data : 2005-3
70 ----------------------------------------------------------------------------------------------------------
71 This routine initializes the digital peripherals.UART0,SMBUS are enable.
72 // P0.0 = UART TX0 (Push-Pull Output)
73 // P0.1 = UART RX0 (Open-Drain Output/Input)
74 // P0.2 = SMBus SDA (Open-Drain Output/Input)
75 // P0.3 = SMBus SCL (Open-Drain Output/Input)
76 *********************************************************************************************************/
77 void PERIAL_Init (void)
78 {
79 1 XBR0 = 0x05;
80 1 XBR1 = 0x00;
81 1 XBR2 = 0x40;
82 1 }
83
84
85
86
87 /*********************************************************************************************************
88 ---------------------------------------------------------------------------------------------------------
89 void PORT_Init (void)
90 Author : Neil
91 Data : 2005-3
92 ---------------------------------------------------------------------------------------------------------
93 This routine initializes the MCU'ports.
94
95 ********************************************************************************************************/
96 void PORT_Init (void)
97 {
98 1 P0MDOUT |= 0x11; // P0.0 (Push-Pull Output)
99 1 // P0.4 (Push-Pull Output) (SCS)
100 1
101 1 P1MDOUT |= 0xE3; // P1.0 (Push-Pull Output)(Digital)
102 1 // P1.1 (Push-Pull Output)(Digital)
103 1 // P1.5 (Push-Pull Output)(Digital) (SCS61B)
104 1 // P1.6 (Push-Pull Output)(Digital) (SCS61G)
105 1 // P1.7 (Push-Pull Output)(Digital) (SCS61R)
106 1 }
107
108
109
110
111 /*********************************************************************************************************
112 ---------------------------------------------------------------------------------------------------------
113 void INTERRUPT_Init (void)
114 Author : Neil
115 Data : 2005-4
C51 COMPILER V7.06 INITIAL 06/13/2005 12:55:37 PAGE 3
116 ---------------------------------------------------------------------------------------------------------
117 This routine initializes the MCU's interrupts.
118
119 ********************************************************************************************************/
120 void INTERRUPT_Init (void)
121 {
122 1 IE = 0x90; //Enable UART0 Interrupt,and global interrupt
123 1 IP = 0x00; //Interrupt Priority
124 1 EIE1 = 0x02; //Extended SMBus Interrupt
125 1 EIE2 = 0x00; //Extended Interrupt Enable 2
126 1 EIP1 = 0x00; //Extended Interrupt Priority 1
127 1 EIP2 = 0x00; //Extended Interrupt Priority 2
128 1 }
129
130
131
132
133
134 /*********************************************************************************************************
135 ---------------------------------------------------------------------------------------------------------
136 void SMBUS_Init (void)
137 Author : Neil
138 Data : 2005-4
139 ---------------------------------------------------------------------------------------------------------
140 SMBus Configuration
141
142 ********************************************************************************************************/
143 void SMBUS_Init (void)
144 {
145 1
146 1
147 1 SMB0CN = 0x40; // Enable SMBus
148 1 SMB0ADR = 0x00; // SMBus Address Register
149 1 SMB0CR = 0xE7; // SMBus Clock Rate @ 400000bps
150 1 }
151
152
153
154
155
156 /*********************************************************************************************************
157 ---------------------------------------------------------------------------------------------------------
158 void UART0_Init (void)
159 Author : Neil
160 Data : 2005-4
161 ---------------------------------------------------------------------------------------------------------
162 Configure the UART0 using Timer1, for <baudrate> and 8-N-1.
163
164 ********************************************************************************************************/
165
166 void UART0_Init (void)
167 {
168 1
169 1 SCON0 = 0x50; // SCON0: mode 1, 8-bit UART, enable RX
170 1 TMOD = 0x20; // TMOD: timer 1, mode 2, 8-bit auto reload
171 1 TH1 = -(SYSCLK/BAUDRATE/16); // set Timer1 reload value for baudrate
172 1 TR1 = 1; // Enable Timer1
173 1 CKCON |= 0x10; // Timer1 uses SYSCLK as time base
174 1 PCON |= 0x80; // SMOD00 = 1
175 1 }
C51 COMPILER V7.06 INITIAL 06/13/2005 12:55:37 PAGE 4
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 90 ----
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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -