📄 cygnalcon.lst
字号:
C51 COMPILER V7.06 CYGNALCON 12/01/2005 16:05:16 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE CYGNALCON
OBJECT MODULE PLACED IN cygnalcon.OBJ
COMPILER INVOKED BY: c:\Keil\C51\BIN\C51.EXE cygnalcon.c LARGE BROWSE INCDIR(F:\software\KEIL\) DEBUG OBJECTEXTEND
stmt level source
1
2 #include <C8051F060.h> // Register definition file.
3 #include <stdio.h>
4 #define SYSCLK 22118400 // SYSCLK frequency in Hz
5 #define BAUDRATE 115200 // Baud Rate for UART0
6
7
8 void SYSCLK_Init (void);
9 void UART0_Init (void);
10 void PORT_Init (void);
11 void config(void)
12 {
13 1
14 1 WDTCN = 0xde; // disable watchdog timer
15 1 WDTCN = 0xad;
16 1 SYSCLK_Init ();
17 1 UART0_Init ();
18 1 PORT_Init ();
19 1 }
20 /* int i; // delay counter
21
22 WDTCN = 0x07; // Watchdog Timer Control Register
23 WDTCN = 0xde; // disable watchdog timer
24 WDTCN = 0xad;
25
26
27
28 OSCXCN = 0x67; // start external oscillator with
29 // 22.1184MHz crystal
30
31 for (i=0; i < 256; i++) ; // XTLVLD blanking interval (>1ms)
32
33 while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
34
35 OSCICN = 0x88; // select external oscillator as SYSCLK
36 // source and enable missing clock
37 // detector
38
39
40
41
42 XBR2 = 0x40; // Enable crossbar and weak pull-up
43
44
45
46
47 P0MDOUT |= 0xFF; // enable TX0 as a push-pull output
48 P1MDOUT |= 0xFF; // enable P1.6 (LED) as push-pull output
49 P2MDOUT |= 0xFF;
50 P3MDOUT |= 0xFF;
51
52 CKCON = 0x00; // Clock Control Register
53 TH0 = 0x70; // Timer 0 High Byte
54 TL0 = 0x00; // Timer 0 Low Byte
55 TMOD = 0x01; // Timer Mode Register
C51 COMPILER V7.06 CYGNALCON 12/01/2005 16:05:16 PAGE 2
56 TCON = 0x10; // Timer Control Register
57
58 */
59 //End of config
60
61 void PORT_Init (void)
62 {
63 1 char old_SFRPAGE = SFRPAGE;
64 1
65 1 SFRPAGE = CONFIG_PAGE; // Switch to configuration page
66 1
67 1
68 1 XBR0 = 0x04; // Enable UART0 on crossbar
69 1 XBR1 = 0x00;
70 1 XBR2 = 0x40; // Enable crossbar and weak pull-ups
71 1 P0MDOUT |= 0xFF; // enable Port0 outputs as push-pull
72 1
73 1 SFRPAGE = old_SFRPAGE; // restore SFRPAGE
74 1 }
75
76 //-----------------------------------------------------------------------------
77 // UART0_Init
78 //-----------------------------------------------------------------------------
79 //
80 // Configure the UART0 using Timer1, for <baudrate> and 8-N-1.
81 //
82 void UART0_Init (void)
83 {
84 1 char old_SFRPAGE = SFRPAGE;
85 1
86 1 SFRPAGE = UART0_PAGE; // Switch to UART0 page
87 1
88 1 SCON0 = 0x50; // SCON: mode 1, 8-bit UART, enable RX
89 1 SSTA0 = 0x10; // Timer 1 generates UART0 baud rate and
90 1 // UART0 baud rate divide by two disabled
91 1
92 1 SFRPAGE = TIMER01_PAGE; // Switch to Timer 0/1 page
93 1
94 1 TMOD = 0x20; // TMOD: timer 1, mode 2, 8-bit reload
95 1 TH1 = -(SYSCLK/BAUDRATE/16); // set Timer1 reload value for baudrate
96 1 TR1 = 1; // start Timer1
97 1 CKCON |= 0x10; // Timer1 uses SYSCLK as time base
98 1 PCON |= 0x80; // SMOD = 1
99 1
100 1 SFRPAGE = UART0_PAGE; // Switch to UART0 page
101 1
102 1 TI0 = 1; // Indicate TX ready
103 1
104 1 SFRPAGE = old_SFRPAGE; // restore SFRPAGE
105 1
106 1 }
107
108 //-----------------------------------------------------------------------------
109 // SYSCLK_Init
110 //-----------------------------------------------------------------------------
111 void SYSCLK_Init (void)
112 {
113 1 char old_SFRPAGE = SFRPAGE;
114 1 int i;
115 1
116 1 SFRPAGE = CONFIG_PAGE; // Switch to Configuration Page
117 1
C51 COMPILER V7.06 CYGNALCON 12/01/2005 16:05:16 PAGE 3
118 1 OSCXCN = 0x67; // start external oscillator with
119 1 // 22.1184MHz crystal on TB
120 1
121 1 for (i=0; i <5000; i++) ; // XTLVLD blanking interval (>1ms)
122 1
123 1 while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
124 1
125 1 RSTSRC = 0x04; // enable missing clock detector reset
126 1
127 1 CLKSEL = 0x01; // change to external crystal
128 1
129 1 OSCICN = 0x00; // disable internal oscillator
130 1
131 1
132 1
133 1 SFRPAGE = old_SFRPAGE; // restore SFRPAGE
134 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 108 ----
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 + -