Won't compile because of C (DDRA, TIMSK, etc)

Hello. I'm having trouble with a sketch I wrote in 2013. When I wrote it, it compiled and worked fine, using Arduino IDE. I haven't changed it, but now it won't compile!

I'm not sure what version of Arduino I had then, (whatever was current in 2013). I tried it with 1.6.5, 1.0.1, 1.0 and 0023. I tried it with the board set as Uno, as Due... In all these cases, it won't recognize the C terms, like DDRA and TIMS.

I am running a bare ATMega 328, but I haven't even got past the compiling!

What happened? What changed? How can I fix it? Thank you for your help.

Arduino: 1.6.5 (Mac OS X), Board: "Arduino Duemilanove or Diecimila, ATmega328"

_3_12_2013_horizontal.ino: In function 'void setup()':
_3_12_2013_horizontal:56: error: 'DDRA' was not declared in this scope
_3_12_2013_horizontal:71: error: 'TIMSK' was not declared in this scope
_3_12_2013_horizontal:74: error: 'GIMSK' was not declared in this scope
_3_12_2013_horizontal:74: error: 'PCIE' was not declared in this scope
_3_12_2013_horizontal:75: error: 'PCMSK' was not declared in this scope
_3_12_2013_horizontal.ino: In function 'void loop()':
_3_12_2013_horizontal:93: error: 'TIMSK' was not declared in this scope
_3_12_2013_horizontal.ino: In function 'void display_number(uint8_t, uint8_t)':
_3_12_2013_horizontal:123: error: 'PORTA' was not declared in this scope
_3_12_2013_horizontal.ino: In function 'void clear_display()':
_3_12_2013_horizontal:230: error: 'PORTA' was not declared in this scope
_3_12_2013_horizontal.ino: In function 'void rot()':
_3_12_2013_horizontal:237: error: 'TIMSK' was not declared in this scope
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:30:0,
from _3_12_2013_horizontal.ino:10:
_3_12_2013_horizontal.ino: In function 'void PCINT_vect()':
_3_12_2013_horizontal.ino:304:6: warning: 'PCINT_vect' appears to be a misspelled signal handler [enabled by default]
'DDRA' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

_3_12_2013_horizontal.ino (8.23 KB)

Which board/chip did you use earlier? ATMega328 does not have DDRA, PORTA, etc.

There is no PORT A on '328s.
Only ports B, C, D. See page paragraphs below and page 625 of the data sheet.

1.1.3 Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers

have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are

externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a

reset condition becomes active, even if the clock is not running.

Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and

input to the internal clock operating circuit.

Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier.

If the Internal Calibrated RC Oscillator is used as chip clock source, PB7...6 is used as TOSC2...1 input for the

Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.

The various special features of Port B are elaborated in ”Alternate Functions of Port B” on page 83 and ”System

Clock and Clock Options” on page 26.
1.1.4 Port C (PC5:0)

Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5...0 output buffers

have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are

externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a

reset condition becomes active, even if the clock is not running.

1.1.5 PC6/RESET

If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ

from those of the other pins of Port C.

If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the

minimum pulse length will generate a Reset, even if the clock is not running. The minimum pulse length is given in

Table 29-16 on page 312. Shorter pulses are not guaranteed to generate a Reset.

The various special features of Port C are elaborated in ”Alternate Functions of Port C” on page 86.|

1.1.6 Port D (PD7:0)

Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers

have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are

externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a

reset condition becomes active, even if the clock is not running.

The various special features of Port D are elaborated in ”Alternate Functions of Port D” on page 89.

Some of the ATtiny models have a PORTA but I don't think any official Arduino has one. The earliest Arduinos used the ATmega8 processor which has a TIMSK but no GIMSK, PORTA, DDRA... Do you know what hardware you were using?

Do you have it set for the right board?

Oh my goodness! As simple as that! I thought I had used a ATMEGA328 but I hadn't! It was an ATTINY!

Thank you so much for the answer!

I'll never exhaust all the ways to make mistakes! That's why I love microcontrollers!