一个循环冗余校验的程序

源代码在线查看: com.lst

软件大小: 29 K
上传用户: lihuitao1987
关键词: 循环冗余校验 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				C51 COMPILER V7.06   COM                                                                   03/29/2008 23:01:42 PAGE 1   
				
				
				C51 COMPILER V7.06, COMPILATION OF MODULE COM
				OBJECT MODULE PLACED IN .\output\COM.obj
				COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE COM\COM.c BROWSE DEBUG OBJECTEXTEND PRINT(.\Listing\COM.lst) OBJECT(.\outpu
				                    -t\COM.obj)
				
				stmt level    source
				
				   1          
				   2          #include  "headfiles\headfiles.h"
				   3          
				   4          struct baudStaff
				   5          {
				   6               char t1;
				   7               char pcon;
				   8          };
				   9          
				  10          
				  11          //Crystal Freq  =  18.432MHz
				  12          
				  13          struct baudStaff code baudList[] =
				  14          {
				  15              {0xff,0x80}, /*0   1152000*/
				  16              {0xfe,0x80}, /*1    576000*/
				  17              {0xfd,0x80}, /*2    288000*/
				  18              {0xfc,0x80}, /*3    144000*/
				  19              {0xf6,0x80}, /*4    115200*/
				  20              {0xec,0x80}, /*5     57600*/
				  21              {0xe2,0x80}, /*6     38400*/
				  22              {0xd8,0x80}, /*7     28800*/
				  23              {0xc4,0x80}, /*8     19200*/
				  24              {0x89,0x80}   //  {0x88,0x80}  /*9      9600*/
				  25          };
				  26          
				  27          void RandT(void) interrupt 4
				  28          {
				  29   1      //   unsigned char tmp;
				  30   1      //  bit bit_tmp;
				  31   1         if(TI)
				  32   1         {
				  33   2      //      TI=0;
				  34   2            return;
				  35   2         }
				  36   1         if(RI)
				  37   1         {
				  38   2             RI=0;
				  39   2      //     tmp = SBUF;
				  40   2      //       Goto_Sleep_timer = 50000;
				  41   2      //         Rcv_Data();
				  42   2      //         bit_tmp = RB8;
				  43   2      //     P1 = tmp;
				  44   2      //     TB8 = RB8;
				  45   2      //     SBUF = tmp;
				  46   2         }
				  47   1      }
				  48          
				  49          
				  50          
				  51          
				  52          
				  53          
				  54          
				C51 COMPILER V7.06   COM                                                                   03/29/2008 23:01:42 PAGE 2   
				
				  55          void SetCom(char baudNum)
				  56          {
				  57   1            SCON = 0xD0;
				  58   1      //      SCON = 0x50;
				  59   1            PCON = baudList[baudNum].pcon;
				  60   1            REN  = 1;
				  61   1            TMOD = 0x21;
				  62   1            TH1  = baudList[baudNum].t1;
				  63   1                TL1  = baudList[baudNum].t1;
				  64   1            AUXR = AUXR|0x40;
				  65   1            TR1  = 1;
				  66   1            ES   = 1;
				  67   1            EA   = 1;
				  68   1      }
				  69          
				  70          
				  71          
				  72          /*
				  73          
				  74          
				  75          void Set_Parity_Bit(unsigned char ch)
				  76          {
				  77            unsigned char j;
				  78            unsigned char temp;
				  79            unsigned char b_tmp;
				  80                  b_tmp = 0;
				  81                  temp = ch;
				  82                  for(j=0;j				  83                   {
				  84                          temp>>=1;
				  85                          if(CY)
				  86                           b_tmp++;   
				  87                   }
				  88                  TB8 = b_tmp&0x01; 
				  89          }
				  90          
				  91          
				  92          bit Set_Parity_Flag;
				  93           
				  94          
				  95          void  Send_Str(unsigned char *str)
				  96          {
				  97          //   Send_Audi_Key = 0;
				  98             while(*str != '\0') 
				  99               {
				 100                     SBUF = *str;
				 101                     Set_Parity_Flag = 1;
				 102                     while(TI == 0)
				 103                     {
				 104                        if(Set_Parity_Flag) 
				 105                              {
				 106                             Set_Parity_Bit(*str);
				 107                                     Set_Parity_Flag = 0;
				 108                                  }     
				 109                     }
				 110                 TI = 0;
				 111                     str++;          
				 112                   }
				 113          //       Delay(30);
				 114          //   Send_Audi_Key = 1; 
				 115          }
				 116          
				C51 COMPILER V7.06   COM                                                                   03/29/2008 23:01:42 PAGE 3   
				
				 117          
				 118          
				 119          void Wait_Send_OK(void)
				 120          {
				 121              while(TI == 0);
				 122                    TI = 0; 
				 123          } 
				 124          
				 125          
				 126          void Send_xxx_char(unsigned char ch)
				 127          {
				 128              unsigned  char tmp;
				 129                  tmp = ((ch&0xF0)>>4);
				 130                  if(tmp				 131                   {
				 132                     Set_Parity_Bit(tmp+48);
				 133                     SBUF = tmp+48;
				 134                   }
				 135                  else
				 136                   {
				 137                     Set_Parity_Bit(tmp+55);
				 138                     SBUF = tmp+55;
				 139                   }
				 140                  Wait_Send_OK();
				 141                  tmp = ch&0x0F;
				 142                  if(tmp				 143                   {
				 144                     Set_Parity_Bit(tmp+48);
				 145                     SBUF = tmp+48;
				 146                   }
				 147                  else
				 148                   {
				 149                     Set_Parity_Bit(tmp+55);
				 150                     SBUF = tmp+55;
				 151                   }
				 152                  Wait_Send_OK();
				 153          }
				 154          
				 155          void Send_HEX_Str(unsigned char *str,unsigned char n)
				 156          {
				 157              while(n!=0)
				 158                    {
				 159                       Send_xxx_char(*str++);
				 160                           Send_Str(" "); 
				 161                           n--;
				 162                    }
				 163          }
				 164          
				 165          */
				 166          
				 167          
				 168          /*
				 169          void Send_HEX_char(unsigned char ch)
				 170          {
				 171              SBUF = '0';
				 172                  Wait_Send_OK();
				 173              SBUF = 'x';
				 174                  Wait_Send_OK();
				 175                  Send_xxx_char(ch);
				 176          }
				 177          */
				 178          
				C51 COMPILER V7.06   COM                                                                   03/29/2008 23:01:42 PAGE 4   
				
				 179          
				 180          
				 181          
				 182          
				
				
				MODULE INFORMATION:   STATIC OVERLAYABLE
				   CODE SIZE        =     72    ----
				   CONSTANT SIZE    =     20    ----
				   XDATA SIZE       =   ----    ----
				   PDATA SIZE       =   ----    ----
				   DATA SIZE        =   ----    ----
				   IDATA SIZE       =   ----    ----
				   BIT SIZE         =   ----    ----
				END OF MODULE INFORMATION.
				
				
				C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
							

相关资源