⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 《8051系列单片机C程序设计完全手册》的光盘中的所有源代码
💻 LST
字号:
C51 COMPILER V6.02  MAIN                                                                   09/15/2002 23:08:41 PAGE 1   


C51 COMPILER V6.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\main.c 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          #include <math.h>
   6          
   7          #ifdef MONITOR51                         /* Debugging with Monitor-51 needs   */
              char code reserve [3] _at_ 0x23;         /* space for serial interrupt if     */
              #endif                                   /* Stop Exection with Serial Intr.   */
  10                                                   /* is enabled                        */
  11          
  12          
  13          /*------------------------------------------------
  14          The main C function.  Program execution starts
  15          here after stack initialization.
  16          ------------------------------------------------*/
  17          void main (void) {
  18   1      
  19   1      	int j,n,p,q,flagp,flagq;
  20   1      /*------------------------------------------------
  21   1      Setup the serial port for 1200 baud at 16MHz.
  22   1      ------------------------------------------------*/
  23   1      #ifndef MONITOR51
  24   1          SCON  = 0x50;		        /* SCON: mode 1, 8-bit UART, enable rcvr      */
  25   1          TMOD |= 0x20;               /* TMOD: timer 1, mode 2, 8-bit reload        */
  26   1          TH1   = 221;                /* TH1:  reload value for 1200 baud @ 16MHz   */
  27   1          TR1   = 1;                  /* TR1:  timer 1 run                          */
  28   1          TI    = 1;                  /* TI:   set TI to send first char of UART    */
  29   1      #endif
  30   1      /*------------------------------------------------
  31   1      Note that an embedded program never exits (because
  32   1      there is no operating system to return to).  It
  33   1      must loop and execute forever.
  34   1      ------------------------------------------------*/
  35   1      	printf("please input n :");
  36   1      	scanf("%d",&n);
  37   1      	if (((n%2)!=0)||(n<=4))
  38   1      		printf("input data error!\n");
  39   1      	else
  40   1      	{
  41   2      		p = 1 ;
  42   2      		do {
  43   3      			p = p + 1 ;
  44   3      			q = n - p ;
  45   3      			flagp=1;
  46   3      			for(j=2; j <= (int)(floor(sqrt((double)(p))));j++)
  47   3      			{
  48   4      				if ((p%j)==0)
  49   4      				{
  50   5      					flagp=0;
  51   5      					break;
  52   5      				}
  53   4      			}
  54   3      			flagq=1;
  55   3      			for (j=2;j<=(int)(floor(sqrt((double)(q))));j++)
C51 COMPILER V6.02  MAIN                                                                   09/15/2002 23:08:41 PAGE 2   

  56   3      			{
  57   4      				if ((q%j)==0)
  58   4      				{
  59   5      					flagq= 0 ;
  60   5      					break;
  61   5      				}
  62   4      			}
  63   3      		} while (flagp*flagq==0);
  64   2      		printf("%d = %d + %d \n",n,p,q);
  65   2      	}
  66   1          while (1) {};
  67   1      }
  68          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    304    ----
   CONSTANT SIZE    =     54    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      12
   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 + -