📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/20/2002 18:41:59 PAGE 1
C51 COMPILER V6.23a, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE DEBUG OBJECTEXTEND
stmt level source
1 #include <REG52.H> /* special function register declarations */
2 /* for the intended 8051 derivative */
3
4 #include <stdio.h> /* prototype declarations for I/O functions */
5
6 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
9 /* is enabled */
10 struct time
11 {
12 int year;/*年*/
13 int month;/*月*/
14 int day;/*日*/
15 } ;
16 union dig
17 {
18 struct time data1;/*嵌套的结构体类型*/
19 char byte[6];
20 } ;
21 /*------------------------------------------------
22 The main C function. Program execution starts
23 here after stack initialization.
24 ------------------------------------------------*/
25 void main (void) {
26 1
27 1 union dig unit;
28 1 int i;
29 1 /*------------------------------------------------
30 1 Setup the serial port for 1200 baud at 16MHz.
31 1 ------------------------------------------------*/
32 1 #ifndef MONITOR51
33 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
34 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
35 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
36 1 TR1 = 1; /* TR1: timer 1 run */
37 1 TI = 1; /* TI: set TI to send first char of UART */
38 1 #endif
39 1 /*------------------------------------------------
40 1 Note that an embedded program never exits (because
41 1 there is no operating system to return to). It
42 1 must loop and execute forever.
43 1 ------------------------------------------------*/
44 1 printf("enter year:\n");
45 1 scanf("%d",&unit.data1.year);/*输入年*/
46 1 printf("enter month:\n");
47 1 scanf("%d",&unit.data1.month);/*输入月*/
48 1 printf("enter day:\n");
49 1 scanf("%d",&unit.data1.day);/*输入日*/
50 1 printf("year=%dmnh%day=%d\n",unit.data1.year,unit.data1.month,unit.data1.day);/*打印输出*/
51 1 for(i=0;i<6;i++)
52 1 printf("%d,",unit.byte[i]);/*按字节以十进制输出*/
53 1 printf("\n");
54 1
55 1 while (1) {};
C51 COMPILER V6.23a MAIN 11/20/2002 18:41:59 PAGE 2
56 1 }
57
58
59
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 239 ----
CONSTANT SIZE = 67 ----
XDATA SIZE = ---- 8
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 + -