一个简单的串口程序。学校的作业了拉。!! !! !! !!1

源代码在线查看: receive.lst

软件大小: 77 K
上传用户: liyuanhang
关键词: 串口程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				C51 COMPILER V6.23a  RECEIVE                                                               04/15/2006 19:32:55 PAGE 1   
				
				
				C51 COMPILER V6.23a, COMPILATION OF MODULE RECEIVE
				OBJECT MODULE PLACED IN receive.OBJ
				COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE receive.c BROWSE DEBUG OBJECTEXTEND
				
				stmt level    source
				
				   1          #include 
				   2                  unsigned char a[]={0x3f,0x06,0x5b,0x4f,0x66 ,0x6d ,0x7d ,0x07 ,0x7f ,0x6f ,0x77 ,0x7c};
				   3          unsigned char buf[1];
				   4                  void delay(unsigned char j) 
				   5              {
				   6   1                unsigned char m,k;
				   7   1                for(m=0;m				   8   1                for(k=0;k				   9   1               }
				  10            
				  11          void Serialinit(void)
				  12          {       
				  13   1              TMOD = (TMOD & 0x0F) | 0x20;      //T1工作方式
				  14   1              TH1 = -6;                        //波特率初始值 注意用倍频方式
				  15   1              PCON |= 0x00;                    //SMOD = 1
				  16   1              TR1 = 1;
				  17   1              SCON = 0x52;    //REN = 1
				  18   1              ES = 1;
				  19   1              EA = 1; }
				  20          void RS232_intr( void ) interrupt 4             //注意RI和TI任一位变为1都中断
				  21          {
				  22   1              
				  23   1              if( RI == 1 ){  RI=0;buf[0]=SBUF; }
				  24   1      
				  25   1      
				  26   1      }
				  27          
				  28          
				  29          
				  30             void display(void) //显示函数
				  31                   {
				  32   1                P0=a[buf[0]];
				  33   1                }
				  34          
				  35          
				  36          
				  37          void main( void )
				  38          {
				  39   1              Serialinit();
				  40   1              buf[0]=9;
				  41   1          P2_0=0;
				  42   1              while( 1 ){ 
				  43   2          display();
				  44   2          delay(25);}
				  45   1      }
				
				
				MODULE INFORMATION:   STATIC OVERLAYABLE
				   CODE SIZE        =     74    ----
				   CONSTANT SIZE    =   ----    ----
				   XDATA SIZE       =   ----    ----
				   PDATA SIZE       =   ----    ----
				   DATA SIZE        =     13    ----
				   IDATA SIZE       =   ----    ----
				   BIT SIZE         =   ----    ----
				C51 COMPILER V6.23a  RECEIVE                                                               04/15/2006 19:32:55 PAGE 2   
				
				END OF MODULE INFORMATION.
				
				
				C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
							

相关资源