Can't verify syntax for interrupt vector

When using the analog comparator on the 328, I have confirmed experimentally that the following syntax works:

ISR(ANALOG_COMP_vect) {

  interval = micros() - currenttime;
  currenttime += interval;
  a++;
  
}

However, when I look into the ATTiny85's data sheet for the comparator's interrupt vector it states that it is ANA_COMP, which makes me think my implementation should be this:

ISR(ANA_COMP) {

  interval = micros() - currenttime;
  currenttime += interval;
  a++;
  
}

...but then I go look in the 328's data sheet and it has "ANA COMP". So now I don't know what to think. I must have got the working code by seeing someone else use it that way and it works despite not matching the data sheet but as there's no consistency, what should I use for the tiny? Thanks.

Vector names always end with "_vect". This cannot possibly be correct...

ISR(ANA_COMP) {

There are inconsistencies with the vector names. Whatever is in the datasheet should be correct.

Wait... so... which of your posts is correct? If the datasheet is correct, then the syntax should be ISR(ANA_COMP) ? Both of them compile so I can't tell.

Gahhhrrrlic:
Wait... so... which of your posts is correct?

Both.

According to the ATmega328(P) datasheet the source name is "ANALOG COMP" which makes the vector name "ANALOG_COMP_vect".

According to the ATtiny85 datasheet the source name is "ANA_COMP" which makes the vector name "ANA_COMP_vect".

The vector name always ends in "_vect".

The names are inconsistent.

Both of them compile so I can't tell.

"Can compile" is irrelevant. Which is a serious annoyance with how vectors are handled.

I see. So there's a convention of sorts, that whatever's in the interrupt table on the datasheet, you have to insert underscores and append with vect. You'd think Atmel expected people to know that somehow lol. Thank you for your help.

I see. So there's a convention of sorts, that whatever's in the interrupt table on the datasheet, you have to insert underscores and append with vect.

This is not a convention. It is a strict syntax rule of the programming language. We have to write it in this particular way : ISR(TWI_vect) and etc.

GolamMostafa:
This is not a convention.

First definition (via Google Search)...

con·ven·tion
noun

  1. a way in which something is usually done, especially within a particular area or activity.
    "the woman who overturned so many conventions of children's literature"
    ...

It is a strict syntax rule of the programming language.

These are all valid C++ identifiers...

ANA_COMP
ANALOG_COMP_vect
AC
ACv
CA
CAV
The_analog_compare_interrupt_vector_for_the_ATtiny85_processor

Any of which would work.

The method used to change source names to vector names is a "convention". The resulting vector names are "syntax".

I suggest you stop trying to argue English language semantics. Given the fact that you could have put "convention" into Google to get to the truth you have demonstrated that you are especially terrible at it.

From the AVR LibC interrupt.h documentation:

t85 - ANA_COMP_vect
m328p - ANALOG_COMP_vect

The data sheets are, unfortunately, a bit confusing. I would suggest using the AVR LibC docs.

Good advice. I found it particularly troubling that one of the data sheets had the _ absent so by checking the libraries, it takes all the mystery away. Thanks.

Ugh, the 328P datasheet does have ANA_COMP in the jump table example. :o
This is the brand spanking new 2/2018 revision. (Older ones have the same.)

oqibidipo:
Ugh, the 328P datasheet does have ANA_COMP in the jump table example. :o

Bummer. Especially given the fact there is not an alias...

grep -d "ANA.*_COMP" *328*.h

iom328p.h
#define ANALOG_COMP_vect_num  23
#define ANALOG_COMP_vect  _VECTOR(23)  /* Analog Comparator */