想做个太阳能小飞机,要用到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;
}
}
}
有兴趣的大佬可以看下飞机的制作流程,太阳能动力飞机。
bbs.

这是原文,根据这个使用IDE 配置attiny85 失败,我在最后发帖了。
www

这是老外的原文,里面有程序,编译这个程序失败。
ww


这是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;
}
}
}