Progamming Arduino Uno (ATmega328) C+ ONLY

Hey i am new to Arduino. But i have programmed alot of HCS12x chips using code warrior.

I would like to program my ATmega328 chip directly with out using given libary. Basically the reason i want to do this because i want to be able to control my timer individually.
That is i want to setup toggle for my ISR.
I have read the datasheet on ATmega328 and it support output compare and toggle. when ever an ISR is called basically i want to use my ISR to drive a PWM around 100KHz. And i want to be able to set my own pre-scaler for my Clock and be able to set up the timer individually for different ISR.

So is it possible to do this if so what compiler do i use or do i just use the compiler that is on the site and just write code in C from scratch.

ALSO where do i assign my vector files. For example if i am use timer channel 1 where do i tell the ISR where the vector is? I don't see any PRM files.

Thanks.

I would like to program my ATmega328 chip directly with out using given libary.

Without any libraries? Start by getting a book on Assembler, then.

I didn't mean with out any libraries exactly. What i am talking about i don't want to use those already setup Pre-Scalers. I want to program my own prescaler. and then Control each output compare for each channel so i can write code for my own ISR.
the main reason i want to do this because i want to control each ISR to interrupt faster than what is already programmed. The main reason behind this is so i can drive faster PWM.
Plus i want to write code directly into some my ISR.
So does anyone know how i can do this or what header file has this information so i can edit it. As before i read this data sheet on the ATmega328 it can do this i am just not sure how i go about implementing it on the arduino board.

The timers are setup as part of the core. There is nothing to prevent you from resetting any of the timers, for your own purpose, as long as you are aware that you will be affecting everything else that uses that same timer.

...or modifying the core to suit your needs. Just don't forget about the modifications when you upgrade to a new version.

What else uses the timers. Because i don't want to use any of the PWM that are provided by the board i want to use those PIN to do other things. still want them to be outputs But i just need 2 PWM. One that runs about 500HZ and one that runs about 100KHz to drive a ultrasonics device that i still have to build.
The thing is i don't really care for the timing that is presetup because i just need TWO timers at the moment until i decide to do other things so I just want to disable the rest timers.
I just want to make sure i have this right They are 4 Timer on this chip each with 2 output compare registers to compare against TCNT(the free running counter)
Is that correct?

Are all 4 of these timer being used?
I also need the main bus clock to run at Full 8MHz i don't want to prescale that. But i read that you can prescale each timer is that correct if so that would be very usefull.
because that means i can execute instructions at the maxium processor speed while still be able to slow down the free running counter for each timer.
When i saw free running counter i mean TCNT ( i belive that what the register is called)
Just let me know if i have this right?

They are 4 Timer on this chip

Three.

What else uses the timers.
Are all 4 3 of these timer being used?

millis, delay, micros, delayMicroseconds are tied to Timer 0.
Timer 1 and Timer 2 are configured for phase-correct PWM but the output is disconnected until you call analogWrite.

But i just need 2 PWM. One that runs about 500HZ and one that runs about 100KHz to drive a ultrasonics device that i still have to build.

Timer 1 and Timer 2.

They are 4 3 Timer on this chip each with 2 output compare registers to compare against TCNT(the free running counter)
Is that correct?

Yes.

I also need the main bus clock to run at Full 8MHz i don't want to prescale that. But i read that you can prescale each timer is that correct if so that would be very usefull.

Yes.

Ok thanks i have to say that one the best reply i had on any forum in a while :).

Just to get this right "millis, delay, micros, delayMicroseconds " are all function that are in some other header file

Yes. The header file is automatically added to your Sketch when you verify (compile). The source code for the header file is included with the Arduino IDE; search for "WProgram.h".

Curious question. The PWM that the chip produces what is the voltage range for it. The reason i want to know is because I need to figure out how to drive a motor in verse.

The pin will be 0V (sink) or VCC (source).

PWM is not much different than this...

  while ( 1 )
  {
    digitalWrite( pin, HIGH );
    delayMicroseconds( HighTime );
    digitalWrite( pin, LOW );
    delayMicroseconds( LowTime );
  }

Yea but that will just give an average DC voltage across the Micro that positive... So no reverses anyway... I'll do a bit more research but if someone could just tell me how to do it it would me much easier..

You can't generate a negative voltage on the Arduino without external hardware.

Thanks for the reply. But i figured out how to do it. Did alot reading on H-Bridge and so on.
I was actually looking at building a object avoidance helicopter. But that be pretty hard and cost alot more i wanted to build it from scratch. Using quad system for helicopter. So that elimates the need for a gyro. But i will need a tilt control so i can know where it tiling in order to be it self balance.
I'll also have to have wireless adapter so i can control it VIA bluebooth maybe from my computer incase something goes wrong the wirless can take over.
I am pretty sure i just stick to my first project though because i don't think i have the money to invest in the helicopter project.