Hi, I want to transfer my Arduino problem to Maple, I find I use a library, and IDE show me some wrong with it.
When I solve other problems, I find this warning"error:'TCCR1A' was not declared in this scope". I know TCCR1A is a timer,but I don't know how to solve this problem ,please help me.
thanks :D!
void InitPWMInterrupt()
{
#if (DEBUG)
Serial2.println("PWM interrupt initialized");
#endif
TCCR1A =
(0 << WGM10) |
(0 << WGM11) |
(0 << COM1A1) |
(1 << COM1A0) | // Toggle pin om compare-match
(0 << COM1B1) |
(0 << COM1B0);
TCCR1B =
(1 << ICNC1)| // Input capture noise canceler - set to active
(1 << ICES1)| // Input capture edge select. 1 = rising, 0 = falling. We will toggle this, doesn't matter what it starts at
(0 << CS10) | // Prescale 8
(1 << CS11) | // Prescale 8
(0 << CS12) | // Prescale 8
(0 << WGM13)|
(1 << WGM12); // CTC mode (Clear timer on compare match) with ICR1 as top.
// Not used in this case:
TCCR1C =
(0 << FOC1A)| // No force output compare (A)
(0 << FOC1B); // No force output compare (B)
TIMSK1 =
(PPM_IN << ICIE1) | // Enable input capture interrupt
(1 << OCIE1A) | // Interrupt on compare A
(0 << OCIE1B) | // Disable interrupt on compare B
(0 << TOIE1);
// OCR1A is used to generate PPM signal and later reset counter (to control frame-length)
OCR1A = DEAD_TIME;
}
//--------------------------------------------------------------------------------------
// Func: InitTimerInterrupt
// Desc: Initializes timer interrupts.
//--------------------------------------------------------------------------------------
void InitTimerInterrupt()
{
#if (DEBUG)
Serial2.println("Timer interrupt initialized");
#endif
TCCR0A =
(0 << WGM00) |
(1 << WGM01) |
(0 << COM0A1) |
(0 << COM0A0) |
(0 << COM0B1) |
(0 << COM0B0);
// 61 hz update-rate:
TCCR0B =
(0 << FOC0A)| //
(0 << FOC0B)| //
(1 << CS00) | // Prescale 1024
(0 << CS01) | // Prescale 1024
(1 << CS02) | // Prescale 1024
(0 << WGM02);
TIMSK0 =
(0 << OCIE0B) |
(1 << OCIE0A) |
(1 << TOIE0);
OCR0B = 64 * 2;
OCR0A = 64 * 2;
}