Those defines are ATMEL defines not Arduino defines.
Yeah, I don't know why Atmel bothered to define all those defines.
(There are hundreds of them)
They are pretty much worthless.
All they do is define the bit number of the bit used within the register.
(and they have them for port/pin/ddr )
Given you had to know the bit number to reference the define name, it seems rather pointless.
So
DD7 is 7
PORT7 is 7
PIN7 is 7
PORTC7 is 7
PORTD7 is 7
DDB0 is 0
PORTB0 is 0
and on and on.
I think people could figure out how to use the bit numbers directly......
Now the other hundreds of defines they created that assign mnemonics to the bit numbers,
in the registers that match the names used in the AVR datasheet those are very useful.
BODS, PUD, WRDF, RXEN0, etc....
The really crazy/lazy ones are the new Arduino defines
like A0, A1, D0, D1, MISO, etc... Those are just plain dumb and begging
to have name collisions. Just look at how they handled their first collision
that people complained about "LED" was changed to "LED_BUILTIN".
They should have used more unique names,with a common prefix on all of them
or even better created a C++ Arduino object so that there would be no collisions and
then it could be referenced like:
Arduino.pin.miso
In terms of being able to directly reference a pin by its AVR port/pin #
Arduino has no such mechanism since the entire pin mapping concept is an arduino thing.
There are libraries that can do direct port i/o from taking an arduino pin #.
But the other way around is pretty hard given the goofy way the Arduino guys have implemented
their pin mapping.
I do it in the glcd library and have written a GPL open source library that does it.
It can be found here:
http://code.google.com/p/mcu-io/downloads/detail?name=avrio.zip
Just keep in mind that this code is intentionally licensed as GPL v3 and not LPGL
so it cannot be used in closed source projects.
It allows you to do direct port i/o by using pin names like:
PIN_Pb
where P is the PORT, A, B, C, ...
and b is the bit number 0 - 7.
i.e.
PIN_C7 would be PORTC bit 7
It works outside the core code so that it can do single cycle i/o operations
rather than the goofy slow table lookup mechanisms that the Arduino core code uses.
It can also do multi bit i/o (like a full byte) in a single cycle when the multiple pins happen to be adjacent bits
in the same register all in the correct order.
Again, I want to emphasized that this code is GPL v3 which forces any project that uses it
to be GPL which is different from most of the other code used in Arduino which uses LGPL v2
which allows use in closed source projects.
--- bill
update: to reflect new mcu-io project where avrio will live