Go Down

Topic: Errors with Timer3 library (Read 1 time) previous topic - next topic

getting the following errors when trying to compile a sketch using Timer3. I'm using
the 1.0 Arduino IDE. I've tried changing board types, no luck

/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::initialize(long int)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:26: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:27: error: 'TCCR3B' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::setPeriod(long int)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:40: error: 'ICR3' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:41: error: 'TCCR3B' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::setPwmDuty(char, int)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:50: error: 'OCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:51: error: 'OCR3B' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:52: error: 'OCR3C' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::pwm(char, int, long int)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:61: error: 'DDRE' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:61: error: 'PORTE3' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:61: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:61: error: 'COM3A1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:62: error: 'DDRE' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:62: error: 'PORTE4' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:62: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:62: error: 'COM3B1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:63: error: 'DDRE' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:63: error: 'PORTE5' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:63: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:63: error: 'COM3C1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::disablePwm(char)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:70: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:70: error: 'COM3A1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:71: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:71: error: 'COM3B1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:72: error: 'TCCR3A' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:72: error: 'COM3C1' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::attachInterrupt(void (*)(), long int)':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:79: error: 'TIMSK3' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::detachInterrupt()':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:86: error: 'TIMSK3' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::start()':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:91: error: 'TCCR3B' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::stop()':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:96: error: 'TCCR3B' was not declared in this scope
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp: In member function 'void TimerThree::restart()':
/Applications/ArduinoFirst.app/Contents/Resources/Java/libraries/Timer3/TimerThree.cpp:101: error: 'TCNT3' was not declared in this scope

Erdin

#1
Mar 16, 2013, 07:38 pm Last Edit: Mar 16, 2013, 07:41 pm by Erdin Reason: 1
Can you give a link to that library ?
And a complete example sketch ?
But I'm using 1.0.4 and 1.5.2, so perhaps the library should be updated.
Which Arduino board do you have ?

Code: [Select]
#include "TimerThree.h"
#include <Rainbowduino.h>
#include <MsTimer2.h>


volatile int interruptParas[10][2];

uint32_t colour;
int resolution;

void setup(){
  Rb.init();
  Serial.begin(9600);
  resolution = 1;
  colour = 0xFFFFFF;
  Timer3.initialize(500);
   Timer3.pwm(9, 512);
 
}


void moveUntil(int sx, int sy, int ex, int ey,uint32_t colour, int timeDelay, int intervalDelay, int intervalCount) { //TODO modified from Rainbowduino_Firmware_v3_oh drawLine
  int i, lx, ly;
 
  lx = abs(ex-sx);
  ly = abs(ey-sy);
  i = 0;
 
  interruptParas[0][0] = intervalDelay;
  interruptParas[1][0] = intervalCount;
  interruptParas[2][0] = lx;
  interruptParas[3][0] = ly;
  interruptParas[4][0] = i;
  interruptParas[5][0] = sx;
  interruptParas[6][0] = sy;
  interruptParas[7][0] = ex;
  interruptParas[8][0] = ey;
 
  if(timeDelay)
  {
    Timer3.setPeriod(timeDelay);
  }
  else
  {
   Timer3.setPeriod(intervalDelay);
  }
  if ( lx > ly)
  {
    Timer3.attachInterrupt(mapPixelLXGreater);
  }
 
  else
  {
    Timer3.attachInterrupt(mapPixelLYGreater);
  }
 


}


void mapPixelLXGreater(){

  int intervalDelay = interruptParas[0][0];
  int intervalCount = interruptParas[1][0];
  int lx = interruptParas[2][0];
  int ly = interruptParas[3][0];
  int i  = interruptParas[4][0];
  int sx = interruptParas[5][0];
  int sy = interruptParas[6][0];
  int ex = interruptParas[7][0];
  int ey = interruptParas[8][0];
  Timer3.setPeriod(intervalDelay);


 
  clearSpace(map(i-1, 0, lx, sx, ex), map(i-1, 0, lx, sy, ey)); // clear previous pixel
  pixel(map(i, 0, lx, sx, ex), map(i, 0, lx, sy, ey), colour);
  intervalCount--;
  interruptParas[1][0]--;
  if(!intervalCount)
  {
    Timer3.detachInterrupt();
  }
 
 
}




void mapPixelLYGreater(){

  int intervalDelay = interruptParas[0][0];
  int intervalCount = interruptParas[1][0];
  int lx = interruptParas[2][0];
  int ly = interruptParas[3][0];
  int i  = interruptParas[4][0];
  int sx = interruptParas[5][0];
  int sy = interruptParas[6][0];
  int ex = interruptParas[7][0];
  int ey = interruptParas[8][0];
  Timer3.setPeriod(intervalDelay);
 
  clearSpace(map(i-1, 0, ly, sx, ex), map(i-1, 0, ly, sy, ey));
   
  pixel(map(i, 0, ly, sx, ex), map(i, 0, ly, sy, ey), colour);
 
  intervalCount--;
  interruptParas[1][0]--;
  if(!intervalCount)
  {
    Timer3.detachInterrupt();
  }   
   

}









void clearSpace(int x, int y){
  for(int i =0; i < resolution;i++)
    for(int j=0; j< resolution; j++)
    {
      Serial.print("I is ");
      Serial.println(i);
      Serial.print("J is ");
      Serial.println(j);
      Rb.setPixelXY((x*resolution)+i, (y*resolution)+j, 0x0, 0x0, 0x0);
    }
     
}



void pixel(int x, int y, uint32_t colour){

  for(int i =0; i < resolution;i++)
    for(int j=0; j< resolution; j++)
    {
     Rb.setPixelXY((x*resolution)+i, (y*resolution)+j, colour);

    }
 
}


void loop()
{
  moveUntil(0,0,7,7, 0xFFFFFF, 100000, 5000, 10);
}




http://www.pjrc.com/teensy/td_libs_TimerOne.html that has both timer 3 and timer 1

If you are using a rainbowduino board, it is based on Atmega 328 which only has a single 16-bit timer (Timer1).

The Timer3 library is made for boards like the Mega2560 which has four 16-bit timers.

That should compile fine if you choose a Mega board.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy