极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 24802|回复: 10

官方ide选择板子为atmega8后无法编译

[复制链接]
发表于 2012-5-17 20:57:42 | 显示全部楼层 |阅读模式
正好自己diy了atmega8的arduino
用的usbasp
所以想搞个红外遥控
我用了iremote的库文件
但是编译的时候就是不通过
选择其他的板子,如uno什么的就可以成功编译....

这是个什么情况,,,,,求解释

附,编译错误的提示信息
源代码:
  1. #include <IRremote.h>
  2. #include <IRremoteInt.h>

  3.    

  4.          int RECV_PIN = 7;
  5.          int sub_PIN = 8;
  6.          int add_PIN = 9;

  7.          
  8.          long on1  = 0x00FFA25D;
  9.          long off1 = 0x00FFE01F;
  10.          long on2 = 0x00FF629D;
  11.          long subKey = 0x00FFA857;
  12.          long on3 = 0x00FFE21D;
  13.          long addKey = 0x00FF906F;
  14.          long on4 = 0x00FF22DD;
  15.          long off4 = 0x00FF6897;
  16.          long on5 = 0x00FF02FD;
  17.          long off5 = 0x00FF9867;
  18.          long on6 = 0x00FFC23D;
  19.          long off6 = 0x00FFB04f;

  20.          IRrecv irrecv(RECV_PIN);
  21.          decode_results results;
  22.           // Dumps out the decode_results structure.
  23.     // Call this after IRrecv::decode()
  24.     // void * to work around compiler issue
  25.     //void dump(void *v) {
  26.     //  decode_results *results = (decode_results *)v
  27.      void dump(decode_results *results) {
  28.       int count = results->rawlen;
  29.       if (results->decode_type == UNKNOWN)
  30.         {
  31.          Serial.println("Could not decode message");
  32.         }
  33.       else
  34.        {
  35.         if (results->decode_type == NEC)
  36.           {
  37.            Serial.print("Decoded NEC: ");
  38.           }
  39.         else if (results->decode_type == SONY)
  40.           {
  41.            Serial.print("Decoded SONY: ");
  42.           }
  43.         else if (results->decode_type == RC5)
  44.           {
  45.            Serial.print("Decoded RC5: ");
  46.           }
  47.         else if (results->decode_type == RC6)
  48.           {
  49.            Serial.print("Decoded RC6: ");
  50.           }
  51.          Serial.print(results->value, HEX);
  52.          Serial.print(" (");
  53.          Serial.print(results->bits, DEC);
  54.          Serial.println(" bits)");
  55.        }
  56.          Serial.print("Raw (");
  57.          Serial.print(count, DEC);
  58.          Serial.print("): ");

  59.       for (int i = 0; i < count; i++)
  60.            {
  61.             if ((i % 2) == 1) {
  62.             Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
  63.            }
  64.           else
  65.            {
  66.             Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
  67.            }
  68.           Serial.print(" ");
  69.            }
  70.             Serial.println("");
  71.            }
  72. void setup()
  73.       {
  74.        pinMode(RECV_PIN, INPUT);
  75.        pinMode(sub_PIN,OUTPUT);
  76.        pinMode(add_PIN,OUTPUT);
  77.        pinMode(13,OUTPUT);
  78.        Serial.begin(9600);

  79.        irrecv.enableIRIn(); // Start the receiver
  80.       }

  81.      int on = 0;
  82.      unsigned long last = millis();

  83. void loop()
  84.      {
  85.       
  86.        if (irrecv.decode(&results))
  87.         {
  88.          // If it's been at least 1/4 second since the last
  89.          // IR received, toggle the relay
  90.          if (millis() - last > 250)
  91.            {
  92.             on = !on;
  93.      //       digitalWrite(8, on ? HIGH : LOW);
  94.             digitalWrite(RECV_PIN , on ? HIGH : LOW);
  95.             dump(&results);
  96.            }

  97.        if (results.value == subKey )
  98.          digitalWrite(sub_PIN, HIGH);
  99.        if (results.value == subKey )
  100.          digitalWrite(add_PIN,HIGH);
  101.         
  102.          last = millis();
  103.          digitalWrite(sub_PIN, LOW);
  104.          digitalWrite(add_PIN, LOW);
  105.          irrecv.resume(); // Receive the next value
  106.        }
  107.      }

复制代码






F:\Arduino\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega8 -DF_CPU=16000000L -DARDUINO=100 -IF:\Arduino\arduino-1.0\hardware\arduino\cores\arduino -IF:\Arduino\arduino-1.0\hardware\arduino\variants\standard -IF:\Arduino\arduino-1.0\libraries\IRremote C:\HexArduino\remoteCtlLed.cpp -oC:\HexArduino\remoteCtlLed.cpp.o
remoteCtlLed.cpp: In function 'void loop()':
remoteCtlLed.cpp:110: warning: comparison between signed and unsigned integer expressions
remoteCtlLed.cpp:112: warning: comparison between signed and unsigned integer expressions
F:\Arduino\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega8 -DF_CPU=16000000L -DARDUINO=100 -IF:\Arduino\arduino-1.0\hardware\arduino\cores\arduino -IF:\Arduino\arduino-1.0\hardware\arduino\variants\standard -IF:\Arduino\arduino-1.0\libraries\IRremote -IF:\Arduino\arduino-1.0\libraries\IRremote\utility F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp -oC:\HexArduino\IRremote\IRremote.cpp.o
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:638: warning: this decimal constant is unsigned only in ISO C90
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:174: error: 'COM2B1' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:182: error: 'COM2B1' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:200: error: 'TIMSK2' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'TCCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'WGM22' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:210: error: 'OCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'TCCR2B' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:226: error: 'OCR2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'TIMSK2' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:229: error: 'OCIE2A' was not declared in this scope
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp: At global scope:
F:\Arduino\arduino-1.0\libraries\IRremote\IRremote.cpp:258: warning: 'TIMER2_COMPA_vect' appears to be a misspelled signal handler


回复

使用道具 举报

 楼主| 发表于 2012-5-17 21:07:40 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2012-5-17 21:57:11 | 显示全部楼层
求库文件。。。。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-5-17 22:11:26 | 显示全部楼层
库文件 包含的头文件声明 我自己做了一点改动,把路径改一下就行了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2012-5-17 22:32:22 | 显示全部楼层
看了下。。。编译出来7.4K大小,已经超过了M8的最大容量。。。是不是因为大小爆了,所以报错。。。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-5-17 23:07:34 | 显示全部楼层
弘毅 发表于 2012-5-17 22:32
看了下。。。编译出来7.4K大小,已经超过了M8的最大容量。。。是不是因为大小爆了,所以报错。。。

额 有道理  还就没考虑过这个...多谢啦  我再压缩程序
回复 支持 反对

使用道具 举报

发表于 2012-9-28 14:33:26 | 显示全部楼层
┏ωǒ┛菰独 发表于 2012-5-17 23:07
额 有道理  还就没考虑过这个...多谢啦  我再压缩程序

请问如何查看编译文件大小啊~!
回复 支持 反对

使用道具 举报

发表于 2012-9-28 16:07:51 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2012-9-28 16:14:08 | 显示全部楼层
我觉得不是这个原因,如果超过容量,应该在上传的时候报错,你这个应该是bootloader比较老,很多宏没有定义,建议用optiboot的bootloader,空间应该够用,1024*8-512=7680
回复 支持 反对

使用道具 举报

发表于 2014-1-18 09:42:21 | 显示全部楼层
遇到同样问题atmega16L 的,按楼主方法解决不了
回复 支持 反对

使用道具 举报

发表于 2014-2-7 15:07:28 | 显示全部楼层
M8 不能用在 IR 上,改用 M328 吧
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-6 05:08 , Processed in 0.038555 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表