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

📄 atmega8.lst

📁 这是本人调试成功的遥控程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 169   5                    break;
 170   5                  case 0x08://B-- RGB
 171   5                    if(++led_display_data[2] >= MAX_FADE_LEVEL)
*** ERROR C187 IN LINE 171 OF .\ATMEGA8.C: not an lvalue
 172   5                      color_value ++;
 173   5                    break;
 174   5                  case 0x09://G-- RB
 175   5                    if(--led_display_data[1] == 0x00)
*** ERROR C187 IN LINE 175 OF .\ATMEGA8.C: not an lvalue
 176   5                      color_value ++;
 177   5                    break;
 178   5                  case 0x0A://B-- R
 179   5                    if(--led_display_data[2] == 0x00)
*** ERROR C187 IN LINE 179 OF .\ATMEGA8.C: not an lvalue
 180   5                      color_value = 1;
 181   5                    break;
 182   5                  default:
 183   5                    color_value = 0;
 184   5                    break;
 185   5                }
 186   4              }
 187   3            } 
C51 COMPILER V6.12  ATMEGA8                                                                02/15/2009 22:19:12 PAGE 5   

 188   2      //******************************************************************
 189   2      break;
 190   2          default:
 191   2         auto_mode = 3;
 192   2            break;
 193   2        }
 194   1      }
 195          /*===========================================================================*/
 196          void init_remote(void)//初始化无线遥控,检测振荡频率
 197          {                     //最小时间为窄脉冲,最长时间为同步头低电平
 198   1        unint temp;
 199   1        uchar i=0;
 200   1        if(!Remot_pin)      //无线接收脚是为低,有信号
*** ERROR C202 IN LINE 200 OF .\ATMEGA8.C: 'PINC': undefined identifier
 201   1        {
 202   2      init_remote_flag:
 203   2          while(Remot_pin)  //等待无线接收脚是为低
*** ERROR C202 IN LINE 203 OF .\ATMEGA8.C: 'PINC': undefined identifier
 204   2         led_scan();
 205   2          for(temp = 0;temp<6400;temp++)//延时大约6400*3.125=20000us
 206   2          {
 207   3            led_scan();     //延时3.125us*temp后检测无线接收脚是否为高
 208   3            if(Remot_pin)
*** ERROR C202 IN LINE 208 OF .\ATMEGA8.C: 'PINC': undefined identifier
 209   3            {
 210   4              if(temp<64)   //如果小于大约64*3.125=200us,为干扰,返回
 211   4                return;
 212   4              if(++i>60)    //检测59次后完成初始化并返回
 213   4              {
 214   5                flag |= 0x01;//初始化完成标志置位
 215   5                remote_count_min += remote_count_min>>1;//计数宽度=最小宽度*3/2 = 4+2
 216   5                remote_count_max = remote_count_max>>3;//同步时间低电平128-4,/8=15>12
 217   5                return;
 218   5              }
 219   4              if(temp<remote_count_min) //判断宽度是否相同并冒泡,保留最小和最大时间
 220   4                remote_count_min = temp;//最小时间
 221   4              else if(temp>remote_count_max)
 222   4                remote_count_max = temp;//最大时间
 223   4              goto init_remote_flag;    //重新开始计数检测
 224   4            }//if(Remot_pin)    
 225   3          }  //for(temp = 0;temp<6400;temp++)    
 226   2        }    //if(!Remot_pin) 
 227   1        else
 228   1          auto_run();     
 229   1      } 
 230          
 231          /*===========================================================================*
 232              _   _   _   _   _   _   _   _   _ 32_   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _   _ 
             -  _   _   _   _   _   _   
 233            _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |
             -_| |_| |_| |_| |_| |_| |_
 234              _______________                                124
 235            _|同步码 4       |______________________________________________________________________________________
             -_________________________
 236              _______________                    12                           _______________
 237          0 _|      4        |_______________________________________________|               |______________________
             -_________________________
 238              ________________________________________________       4        ______________________________________
             -__________
 239          1 _|               12                               |______________|                                      
             -          |______________
 240              _______________                   12                            ______________________________________
C51 COMPILER V6.12  ATMEGA8                                                                02/15/2009 22:19:12 PAGE 6   

             -__________
 241          F _|      4        |_______________________________________________|                                      
             -          |______________
 242          *===========================================================================*/
 243          uchar remote_decode(void)//无线遥控解码
 244          {
 245   1        uchar i,j;
 246   1        unint temp;
 247   1        if(!Remot_pin)      //无线接收脚是为低,有信号
*** ERROR C202 IN LINE 247 OF .\ATMEGA8.C: 'PINC': undefined identifier
 248   1        {
 249   2          for(i=0;i<64;i++)//延时64*3.125=200us看是否干扰
 250   2          {
 251   3            led_scan();
 252   3            if(Remot_pin)
*** ERROR C202 IN LINE 252 OF .\ATMEGA8.C: 'PINC': undefined identifier
 253   3              return 0;      
 254   3          }
 255   2          while(!Remot_pin)//等待高电平
*** ERROR C202 IN LINE 255 OF .\ATMEGA8.C: 'PINC': undefined identifier
 256   2            led_scan();
 257   2          while(Remot_pin) //等待低电平
*** ERROR C202 IN LINE 257 OF .\ATMEGA8.C: 'PINC': undefined identifier
 258   2            led_scan();
 259   2          for(temp=0;temp<remote_count_max;temp++)//宽脉冲12<检测同步头延时124/8=15<同步头低电平124
 260   2          {                               
 261   3            led_scan();                   
 262   3            if(Remot_pin) //不是同步头,返回 
*** ERROR C202 IN LINE 262 OF .\ATMEGA8.C: 'PINC': undefined identifier
 263   3              return 0;        
 264   3          }
 265   2          receive_data_buff[0]=receive_data_buff[0]=receive_data_buff[0]=0;//清零接收缓存
*** ERROR C213 IN LINE 265 OF .\ATMEGA8.C: left side of asn-op not an lvalue
 266   2          for(i=0;i<3;i++)                            //检测到同步头,接收24位数据
 267   2          {
 268   3            for(j=0;j<8;j++)
 269   3            {
 270   4              while(!Remot_pin)                       //等待高电平,等待同步头结束
*** ERROR C202 IN LINE 270 OF .\ATMEGA8.C: 'PINC': undefined identifier
 271   4                led_scan();
 272   4      receive_flag:
 273   4              while(Remot_pin)                        //等待第一个数据的低电平
*** ERROR C202 IN LINE 273 OF .\ATMEGA8.C: 'PINC': undefined identifier
 274   4                led_scan();    
 275   4              for(temp=0;temp<remote_count_min;temp++)//窄脉冲4<延时4+2=6<宽脉冲12
 276   4              {
 277   5                led_scan();  
 278   5                if(Remot_pin)                         //在延时期间出现高电平为窄脉冲
*** ERROR C202 IN LINE 278 OF .\ATMEGA8.C: 'PINC': undefined identifier
 279   5                {
 280   6                  receive_data_buff[i] |= 1<<j;       //窄脉冲为1
*** ERROR C213 IN LINE 280 OF .\ATMEGA8.C: left side of asn-op not an lvalue
 281   6                  goto receive_flag;
 282   6                }
 283   5              }                                       //宽脉冲为0不用赋值
 284   4            }
 285   3          }
 286   2       if(receive_data[0]==receive_data_buff[0]&&receive_data[1]==receive_data_buff[1]&&receive_data[2]==receive
             -_data_buff[2])
 287   2       {
 288   3            if(++check_con>5)//连续检测到5次数据相同认为是连按
 289   3           flag |= 0x02;  //连按标志置位
C51 COMPILER V6.12  ATMEGA8                                                                02/15/2009 22:19:12 PAGE 7   

 290   3       }
 291   2       return 1;
 292   2        }
 293   1        return 0;
 294   1      } 
 295          
 296          //****************************************************************
 297          void remote_cont(void)//连按处理程序
 298          {  
 299   1      }
 300          void remote_run(void) //无线遥控代码执行
 301          {
 302   1      }
 303          #pragma interrupt_handler usart_isr:12  
*** WARNING C245 IN LINE 303 OF .\ATMEGA8.C: unknown #pragma, line ignored
 304          void usart_isr(void)                          //串口中断
 305          {
 306   1        uchar temp;
 307   1        temp = UDR;
*** ERROR C202 IN LINE 307 OF .\ATMEGA8.C: 'UDR': undefined identifier
 308   1        UDR = temp;
*** ERROR C202 IN LINE 308 OF .\ATMEGA8.C: 'UDR': undefined identifier
 309   1      }
 310          void main(void)
 311          {
 312   1        //I/O口初始化
 313   1        PORTB = 0x00;
*** ERROR C202 IN LINE 313 OF .\ATMEGA8.C: 'PORTB': undefined identifier
 314   1        DDRB  = 0x00;
*** ERROR C202 IN LINE 314 OF .\ATMEGA8.C: 'DDRB': undefined identifier
 315   1        PORTC = 0x00;
*** ERROR C202 IN LINE 315 OF .\ATMEGA8.C: 'PORTC': undefined identifier
 316   1        DDRC  = 0x38;
*** ERROR C202 IN LINE 316 OF .\ATMEGA8.C: 'DDRC': undefined identifier
 317   1        PORTD = 0x00;
*** ERROR C202 IN LINE 317 OF .\ATMEGA8.C: 'PORTD': undefined identifier
 318   1        DDRD  = 0x00;  
*** ERROR C202 IN LINE 318 OF .\ATMEGA8.C: 'DDRD': undefined identifier
 319   1        //串口初始化
 320   1        UCSRB = 0x00; 
*** ERROR C202 IN LINE 320 OF .\ATMEGA8.C: 'UCSRB': undefined identifier
 321   1        UCSRA = 0x00;
*** ERROR C202 IN LINE 321 OF .\ATMEGA8.C: 'UCSRA': undefined identifier
 322   1        UCSRC = (1<<UCSZ1)|(1<<UCSZ0)|(1<<USBS);  //8位数据位2位停止位
*** ERROR C202 IN LINE 322 OF .\ATMEGA8.C: 'UCSRC': undefined identifier
 323   1        UBRRL = (Fosc*1000000/16/BAUD)%256-1;     //波特率
*** ERROR C202 IN LINE 323 OF .\ATMEGA8.C: 'UBRRL': undefined identifier
 324   1        UBRRH = (Fosc*1000000/16/BAUD)/256;
*** ERROR C202 IN LINE 324 OF .\ATMEGA8.C: 'UBRRH': undefined identifier
 325   1        UCSRB = (1<<RXEN)|(1<<TXEN)|(1<<RXCIE);   //接收/发送中断使能
*** ERROR C202 IN LINE 325 OF .\ATMEGA8.C: 'UCSRB': undefined identifier
 326   1        SEI();                                    //打开全局中断允许位
*** WARNING C206 IN LINE 326 OF .\ATMEGA8.C: 'SEI': missing function-prototype
 327   1      
 328   1        led_display_data[0] =0x32;  
*** ERROR C213 IN LINE 328 OF .\ATMEGA8.C: left side of asn-op not an lvalue
 329   1        led_display_data[1] =0x96;  
*** ERROR C213 IN LINE 329 OF .\ATMEGA8.C: left side of asn-op not an lvalue
 330   1        led_display_data[2] =0x128;  
*** ERROR C213 IN LINE 330 OF .\ATMEGA8.C: left side of asn-op not an lvalue
 331   1        while(1)
 332   1        {
C51 COMPILER V6.12  ATMEGA8                                                                02/15/2009 22:19:12 PAGE 8   

 333   2          if(flag&0x01)
 334   2            if(remote_decode())
 335   2           if(flag&0x02)    
 336   2          remote_cont();  //连按
 337   2        else
 338   2                remote_run();   
 339   2            else
 340   2              auto_run();
 341   2          else
 342   2            init_remote();      //初始化遥控数据
 343   2        }
 344   1      }
 345          
 346          

C51 COMPILATION COMPLETE.  3 WARNING(S),  83 ERROR(S)

⌨️ 快捷键说明

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