ardunio IDE 使用Attiny85 GIMSK 未定义求助!
arduino吧
全部回复
仅看楼主
level 3
小安886 楼主
想做个太阳能小飞机,要用到attiny85,根据教程配置文件,配置失败。然后自己找IDE如何使用attiny85,弄好了,然后程序现在编译出错,提示没有GIMSK PCMSK TIMSK 的定义,专门去搜了库也编译不了。求助一下大佬。
有兴趣的大佬可以看下飞机的制作流程,太阳能动力飞机。
bbs.[怒]5imx.com/forum.php?mod=viewthread&tid=1555925&extra=&page=1
这是原文,根据这个使用IDE 配置attiny85 失败,我在最后发帖了。
www[怒].rcgroups.com/forums/showthread.php?3009203-MPPT-for-F5E
这是老外的原文,里面有程序,编译这个程序失败。
ww[阴险]w.jianshu.c[阴险]om/p/9e746f3a03dd?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
这是Attiny85 使用IDE 外部中断的 一个文章,里面介绍了如何引用 库文件,使得GIMSK有定义,我试过了,依旧编译失败。
附图,鼓捣一晚上了,没折腾明白,看了很多帖子说这个库在arm下不能使用,所以,作者到底怎么编译成功的?
附上程序:
/*MPPT v6.3 for F5E RC Solar Airplane
/太阳能电池飞机 6.3版
pin2 solar voltage coming off a divider. 1.1v max. 300k and pin2 across 47k to ground
/pin2接口接太阳能电池板电压分压线,最大1.1V输入 pin2接口和300K电阻接口需要一个47K的电阻接地
pin3 rc input comeing from rx
/pin3接口接遥控器油门信号输入
pin4 rc output going to esc
/pin4接口接电调信号线
Sergey Vekli and Ted Luginbuhl
/谢尔盖·维克利和泰德·卢金布尔 制作
__ __
Reset -|o \/ |- VCC
3 Rx -|ATTINY|- 2 Solarvoltage
4 ESC -| 45/85|- 1
GND -|______|- 0
*/
#define Vmpp 0.55 // good setting: 0.84 for 12 cell and .55 for 8 cell. If too low motor will be faster at less than full throttle.
#define VmppLOW 0.63 // low throttle mpp voltage. 0.97 seems to be good for 12 cell and .63 for 8 cell.Set so that motor cuts off when parallel with suns rays.
#define STEPdown 2 //default 2 If too high throttle will oscilate, if too low esc will reset
#define STEPup 1
#define iterations 15 //default 15. This is how many times the algo averages the array voltage.
#define transition 150 // point at wich transition takes place from Vmpp to VmppLOW between 110 and 230. Default 150.If too high it will kick in too soon and mimick Vmpp set too low.
#define LOW false
#define HIGH true
#include "avr/interrupt.h"
int x = 0;
int Vcell = 0;
int VMPP = 0.00;
int VMPPlow = 0.00;
boolean cur_level = LOW;
void setup()
{
// set pins mode
pinMode(4, OUTPUT); //going to esc
pinMode(3, INPUT); //coming from rx
//convert Vmpp to adc levels
VMPP = Vmpp * 925;
VMPPlow = VMPPlow * 925;
//set freq and interrupts registers
GIMSK = B00100000;
PCMSK = B00001000;
TCCR0A = B00000010;
TCCR0B = B00000010;
TIMSK = B00010000;
OCR0A = 110;
analogReference(INTERNAL1V1);
}
//main control timer
ISR(TIMER0_COMPA_vect)
{
if (cur_level == HIGH)
{
digitalWrite(4, LOW);
cur_level = LOW;
}
TCNT0 = 0;
}
//interrupt for rx repeater mode
ISR(PCINT0_vect)
{
if (digitalRead(3) > cur_level)
{
digitalWrite(4, HIGH);
cur_level = HIGH;
TCNT0 = 0;
}
else
{
if (cur_level == HIGH)
{
digitalWrite(4, LOW);
cur_level = LOW;
}
}
}
//main measurement-set cycle
void loop()
{
if (OCR0A <= transition) // throttle level at wich higher Vmpp kicks in else statement.
{
x = VMPPlow;
}
else
{
x = VMPP;
}
Vcell = 0;
for (int XX = 0; XX < iterations; XX++) //iterations for average array voltage.
{
delay(1);
Vcell = Vcell + analogRead(A1);
}
Vcell = Vcell / iterations;
//Vcell=analogRead(A1);
if (Vcell > x)
{
if (OCR0A <= 230 ) //230
{
OCR0A += STEPup;
}
}
if (Vcell < x)
{
if (OCR0A >= 110) { //110
OCR0A -= STEPdown;
}
}
}
2020年07月28日 17点07分 1
level 3
小安886 楼主
这两部份有问题
GIMSK = B00100000;
PCMSK = B00001000;
TCCR0A = B00000010;
TCCR0B = B00000010;
TIMSK = B00010000;
OCR0A = 110;

OCR0A = 110;
analogReference(INTERNAL1V1);
2020年07月28日 17点07分 2
level 3
小安886 楼主
声明:图不是我的
附带两张照片,有些大佬比较懒可能不愿意去看链接里面的飞机,恩 这个就是个太阳能动力的小飞机,按照作者的测试中午12点左右可以出去飞的很开心,晒黑黑有么有!
2020年07月28日 17点07分 3
level 3
小安886 楼主
所以....写程序的大佬不都是夜猫子么....[泪]
溜了溜了 早上起来再来看
2020年07月28日 17点07分 4
level 3
小安886 楼主
哭瞎,,,早上来看了看,发的三个帖子都没有人给回复[泪]
难道是因为这个问题太简单?
2020年07月29日 02点07分 5
level 3
小安886 楼主
真就没有人遇到这个问题吗。。。。。太忧郁了,又折腾一上午,#include "avr/interrupt.h"这个库文件貌似有问题。。。
2020年07月29日 05点07分 6
level 3
小安886 楼主
解决了,很简单的一个问题,妈耶
因为arduino的 interrupt 库文件有问题,需要自行下载最新ARM的库文件覆盖即可,真TTTMMMDDD吐血了
//bbs.elecfans.com/forum.php?mod=viewthread&tid=409324&extra=page=1
里面有库文件下载,下载以后在安装目录下,直接搜索interrupt 然后复制过去覆盖即可。
给后面遇到这个问题的人一点经验~匿了
2020年07月29日 05点07分 7
感谢佬,明天试一下
2026年01月27日 14点01分
1