ERROR: TCCR3A was not declared in this scope

5 posts / 0 new
Last post
billvv's picture
billvv
Offline
Joined: 04/07/2020 - 11:39am
ERROR: TCCR3A was not declared in this scope

When selecting the Uno and compiling this code...

// generated by: RTM_TimerCalc -- RuntimeMicro.com
// Timer3 Mode_10_16Bit_Phase_TOP_is_ICR
TCCR3A = 0xA2; // 1010 0010
TCCR3B = 0x10 | 2; // Prescale=8
ICR3 = 50000-0;
OCR3A = (int) (ICR3 * 0.25);
OCR3B = (int) (ICR3 * 0.5);
pinMode(5, OUTPUT); // OC3a
pinMode(2, OUTPUT); // OC3b

Gives this error...."'TCCR3A' was not declared in this scope" The avr file arduino\hardware\tools\avr\avr\include\avr\iom168.h for the Uno does not contain TCCR3A. Selecting the Mega, file... iom2560.h ... includes this file: iocanxx.h, which does contain TCCR3A and compiles without errors.

Runtime Micro's picture
Runtime Micro
Offline
Joined: 07/24/2016 - 9:18am

Hi Bill,

I took the liberty of putting your post on the Forum. I captured it from the site logs.

Answer;

The Uno has only 3 Timers; labeled 0, 1 and 2. Timer3 exists on a 2560 only. Just select Timer-1 to get a 16-bit and the code should run fine.

Lee

billvv's picture
billvv
Offline
Joined: 04/07/2020 - 11:39am

Thank you, Lee

Looks like I'm able to post. Maybe it was the rich text editor.

Runtime Micro's picture
Runtime Micro
Offline
Joined: 07/24/2016 - 9:18am

OK billvv, Smile

What I should have said was -- select Timer-1 on RTM_TimerCalc and its generated code should run fine on your Uno.

stockvu's picture
stockvu
Offline
Joined: 07/20/2016 - 8:57am

> Maybe it was the rich text editor.

I don't think so. But in case you're right, I have modified RTM_TimerCalc to use Unicode text as a default Setting.

Users can revert to Rich-Text or even select ANSI format. This should make copied-code compatible with just about any IDE variant out there.

Version 1.20 has lots of new stuff and it takes time to get it all organized and documented.

More soon... Smile

Lee

Log in or register to post comments