📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/13/2002 23:21:05 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 #define M 3
10 #define N 4
11 /* is enabled */
12 /*------------------------------------------------
13 The main C function. Program execution starts
14 here after stack initialization.
15 ------------------------------------------------*/
16 void main (void) {
17 1
18 1 float a[M][N];
19 1 float score1,score2,score3, *pa=a[0];/*指针变量p a 指向二维数组*/
20 1 /* score1,score2,score3 分别记录三行的数据相加*/
21 1 int i,j;
22 1 void fun(float b[][N],float *p1,float *p2,float *p3);
23 1 /*------------------------------------------------
24 1 Setup the serial port for 1200 baud at 16MHz.
25 1 ------------------------------------------------*/
26 1 #ifndef MONITOR51
27 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
28 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
29 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
30 1 TR1 = 1; /* TR1: timer 1 run */
31 1 TI = 1; /* TI: set TI to send first char of UART */
32 1 #endif
33 1 /*------------------------------------------------
34 1 Note that an embedded program never exits (because
35 1 there is no operating system to return to). It
36 1 must loop and execute forever.
37 1 ------------------------------------------------*/
38 1 for( i = 0 ; i < M ; i++)
39 1 for(j=0;j<N; j++)/*二维数组的数据输入*/
40 1 scanf("%f",&a[i][j]) ;
41 1 fun(pa,&score1,&score2,&score3) ;
*** WARNING C182 IN LINE 41 OF MAIN.C: pointer to different objects
42 1 /*函数调用,不仅传递数组首地址,还要传递变量的地址*/
43 1 printf("%.2f,%.2f,%.2f\n",score1,score2,score3);
44 1 while (1) {};
45 1 }
46
47
48
49 void fun(float b[][N],float *p1,float *p2,float *p3)
50 {
51 1 int i,j;
52 1 *p1=*p2=*p3=0;
53 1 for(i=0; i < M ; i++)
54 1 for ( j = 0 ; j < N ; j++)
C51 COMPILER V6.23a MAIN 11/13/2002 23:21:05 PAGE 2
55 1 {
56 2 if(i==0) *p1=*p1+b[i][j];/*第0 行的数据相加*/
57 2 if(i==1) *p2=*p2+b[i][j];/*第1 行的数据相加*/
58 2 if(i==2) *p3=*p3+b[i][j];/*第2 行的数据相加*/
59 2 }
60 1 }
61
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 790 ----
CONSTANT SIZE = 19 ----
XDATA SIZE = ---- 83
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -