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

📄 urt841.lst

📁 ADuC841的详细程序
💻 LST
字号:
C51 COMPILER V5.50,  URT841                                                                20/10/03  09:05:33  PAGE 1   


DOS C51 COMPILER V5.50, COMPILATION OF MODULE URT841
OBJECT MODULE PLACED IN URT841.OBJ
COMPILER INVOKED BY: C:\ADUC\BIN\C51.EXE URT841.C DB

stmt level    source

   1          //urt841.c
   2          /*
   3          Author: Eckart Hartmann Date:15/10/2003
   4          Description of Software: 
   5          	This program demonstrates the UART functions <A HREF="/mcc/softw/841/urt/Urt841Cfg.html">UrtCfg()</A>,  
   6          	<A HREF="/mcc/softw/841/urt/Urt841Bsy.html">UrtBsy()</A>, <A HREF="/mcc/softw/841/urt/Urt841Get.html">get
             -key()</A>  
   7          	and <A HREF="/mcc/softw/841/urt/Urt841Put.html">putchar()</A>.
   8          Development progress: <A HREF="/mcc/softw/834/urt/Urt834Df.html">Urt834.df</A>
   9          
  10          _getkey and putchar in the standard c51s.lib are replaced by new versions.
  11          The enhancements compared to Keil are that T1, T2 or the fractional divider
  12          can be initialised for baudrate generation. Also odd, even or no parity 
  13          can be chosen. No parity and two stop bits (mark parity) is also offered. 
  14          Lastly an error indicator is provided.
  15          
  16          This demonstration receives characters and when a newline is received it 
  17          returns the string with slight modification. (Note that for some parity 
  18          errors the newline character is not recognised and 22 characters must be 
  19          entered.) This is repeated 4 times with no, even and odd parity and 2 
  20          stop bits. Each one can use any of the timers at various baudrates by 
  21          changing the parameters for UrtCfg() manually and recompiling.
  22          
  23          Windows Hyperterminal can be used for the test with correct operation for
  24          the correct parameters and failure for the others. Note though that the 
  25          difference between 1 and 2 stop bits is normally not detected.
  26          
  27          Correct operation is indicated by "Hello " then the characters sent. then
  28          the value of parameter1 of UrtCfg in "pseudo hex".
  29          */
  30          #include"..\kei841.h"	//;<A HREF="/mcc/softw/841/Kei841Sfr.html">SFR definition file</A>.
  31          #include"..\lib841.h"	//;<A HREF="/mcc/softw/841/Lib841H.html">Function and variable declaration file</A>.
  32          #include<stdio.h>	//"stdio.h"
  33          #include<ctype.h>	//"ctype.h"
  34          
  35          void main(void)
  36          	{
  37   1      	char pcHW[30] = {"Hello World"};
  38   1      	char c1;
  39   1      	
  40   1      //	UrtCfg(0x0f,0x8608);	//8,e,1.
  41   1      //	UrtCfg(0x0b,0x8608);	//8,o,1.
  42   1      	UrtCfg(0x07,0x8608);	//8,n,2.
  43   1      //	UrtCfg(0x03,0x8608);	//8,n,1
  44   1      //	UrtCfg(0x06,-72);	//8,n,2.
  45   1      	printf("\nEnter strings terminated by Enter.\n");
  46   1      	UrtCfg(0x02,-72);
  47   1      	scanf("%22s",&pcHW[6]);
  48   1      	if(cUrtVar&0x80)
  49   1      		{
  50   2      		while(!TI);
  51   2      		PllDly(5);	//<A HREF="/mcc/softw/841/pll/Pll841Dly.html">PllDly</A> to settle false start.
  52   2      		UrtCfg(0x06,-72);
  53   2      		puts("Parity off error");
  54   2      		}
  55   1      	c1 = 7;
  56   1      	while(c1<22 && (pcHW[c1]!=0))	c1++;
  57   1          	pcHW[c1++] = ' ';
  58   1          	pcHW[c1++] = ((cUrtVar>>4)&0x0f)+'0';
C51 COMPILER V5.50,  URT841                                                                20/10/03  09:05:33  PAGE 2   

  59   1          	pcHW[c1++] = (cUrtVar&0x0f)+'0';
  60   1          	pcHW[c1++] = '\n';
  61   1          	pcHW[c1++] = 0;
  62   1      	puts(pcHW);
  63   1      
  64   1      	UrtCfg(0x0e,-72);
  65   1      	scanf("%22s",&pcHW[6]);
  66   1      	if(UrtBsy()&0x80)
  67   1      		{
  68   2      		while(!TI);
  69   2      		PllDly(5);	//  Settle false start.
  70   2      		UrtCfg(0x06,-72);
  71   2      		puts("Parity even error");
  72   2      		}
  73   1      	c1 = 7;
  74   1      	while(c1<22 && (pcHW[c1]!=0))	c1++;
  75   1          	pcHW[c1++] = ' ';
  76   1          	pcHW[c1++] = ((cUrtVar>>4)&0x0f)+'0';
  77   1          	pcHW[c1++] = (cUrtVar&0x0f)+'0';
  78   1          	pcHW[c1++] = '\n';
  79   1          	pcHW[c1++] = 0;
  80   1      	puts(pcHW);
  81   1      
  82   1      	UrtCfg(0x09,-12);
  83   1      	scanf("%22s",&pcHW[6]);
  84   1      	if(UrtBsy()&0x80)
  85   1      		{
  86   2      		while(!TI);
  87   2      		PllDly(5);	// False start settles.
  88   2      		UrtCfg(0x06,-72);
  89   2      		puts("Parity odd error");
  90   2      		}
  91   1      	c1 = 7;
  92   1      	while(c1<22 && (pcHW[c1]!=0))	c1++;
  93   1          	pcHW[c1++] = ' ';
  94   1          	pcHW[c1++] = ((cUrtVar>>4)&0x0f)+'0';
  95   1          	pcHW[c1++] = (cUrtVar&0x0f)+'0';
  96   1          	pcHW[c1++] = '\n';
  97   1          	pcHW[c1++] = 0;
  98   1      	puts(pcHW);
  99   1      
 100   1      	UrtCfg(0x06,-72);
 101   1      	scanf("%22s",&pcHW[6]);
 102   1      	if(cUrtVar&0x80)
 103   1      		puts("2 Stop bit error");
 104   1      	c1 = 7;
 105   1      	while(c1<22 && (pcHW[c1]!=0))	c1++;
 106   1          	pcHW[c1++] = ' ';
 107   1          	pcHW[c1++] = ((cUrtVar>>4)&0x0f)+'0';
 108   1          	pcHW[c1++] = (cUrtVar&0x0f)+'0';
 109   1          	pcHW[c1++] = '\n';
 110   1          	pcHW[c1++] = 0;
 111   1      	puts(pcHW);
 112   1      	printf("\nEnd. Press reset to restart.\n");
 113   1      	while(1);
 114   1      	}


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    670    ----
   CONSTANT SIZE    =    172    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2      31
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
C51 COMPILER V5.50,  URT841                                                                20/10/03  09:05:33  PAGE 3   

END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -