Hahaha! Well, I hate to say it but to some extent yeah, everything has to start with some crazy header file and twelve friends. Though they have been known to travel in smaller parties than that.
A good place to start with C programming on micros is Joe Pardue’s book, “C Programming for Microcontrollers”. It uses the AVR Butterfly for its examples, but the ATmega169 on the Butterfly isn’t TOO different from the ATmega644 on the OX2. Some of the stuff in the book won’t be of immediate use (like driving the Butterfly’s LCD, which is completely different from driving the OX2’s LCD), but a lot of it is of immediate utility (digital I/O, analog input, etc.)
I don’t have all the OX2’s stuff rolled in yet, but another place to start is Orangutan-lib. The digital I/O and the analog input stuff will work fine, in any case. (So will the LCD stuff, for that matter.) There are a bunch of example programs in there that you can at least get some ideas from.
Your PORTC.2 example is how the Imagecraft AVR C compiler handles general purpose I/O ports. With AVR Studio it’s a little more involved, but it’s also more standard C:
DDRC |= (1 << 2); // Set PORTC bit 2 as an output
PORTC |= (1 << 2); // Set PORTC bit 2 high
PORTC &= ~(1 << 2); // Set PORTC bit 2 low
But that needs:
#include <avr/io.h> // Include I/O port definitions
For ADC stuff I’ll refer you to the Orangutan-lib example. It amounts to:
input1 = analog(1);
But you also need to link in analog.c from the library.
If this is your first exposure to C, that probably won’t help much. The book would help, reading through the library stuff would help, and one other place to look would be avrfreaks.net which is a discussion forum for people doing AVR development. Lots and lots of good info there.
Hope this helps.
P.S. Best bet for the files on the OX2 is to download the interface code that’s posted on the OS2 page, include all the .h files, link in all the .c files, and all the routines in those files are available to you at that point. The 644 has enough memory you won’t even be putting a scratch in it to just include the whole shebang.