Hi, I'm currently writing a program in (normal) c++ using the arduino uno board, and have some doubts about what basic initializations I may need to do.
The arduino board has an external crystal in it (connected in PB6 and PB7), do I need to write some code to tell the microcontroller about that?
I've tested my program and it works, but I'm not sure if it is using the crystal for the 16Mhz or using the internal setting (at 8Mhz I think).
Also, in digital pins 0 and 1 seems to be used for communication, I've tried using those bits but doesn't seem to work that well. Are they reserved? Or do I need to configure it in some way?
Any other stuff I should take care in the initial configuration?
You can write C++ code without having to do any low level initialization yourself.
This page has an overview of the build process: http://www.arduino.cc/en/Hacking/BuildProcess
A google search for Arduino C++ turns up lots of hits that may be of interest
If you are curious about he hardware initialization code you can find it in hardware>arduino>cores>arduino>wiring.c
Ok, it seems the crystal is set with some special bits (fuse bits), which don't loose its configuration between flash erases.
I looked up that file and it seems that in the init() it only starts the timers, activates the global interrupt flag.. the usart... its what I've done in my program so.. :)
What about the digital pins 0 and 1 used for the communication? Didn't find any info on that.
Are you trying to bypass all the low level Arduino code. If that is the the case could you say why you want to do that?
yes, I'm trying to write a program independent of the arduino (but using the board, since its the only I have).
Its for learning purposes, I already have some experience with c++ (but not on microcontrollers), and I'm trying to understand how this works.
Have a look at http://www.avrfreaks.net/
Its a good source of information on the low level hardware