I am new to the embedded platform. I am using STM32 board and Keil micro vision5. I have a few basic doubts. I searched on the internet, but i couldn't find any useful stuff related to my doubts. First is related to array indexing in Keil. Will it start at 0 or 1? I feel it is 0. Isn't it? Second is related to while loop. In some examples, in the main function, one function is getting called and after that, they are using while(1){}. Why we are doing this? I know while(1) is an infinite loop. if you call a function inside this while loop, the function will be called continuously. That is understandable. Then why they are writing like that? what is the intention of writing like that?
"array indexing in Keil."
Keil complies with the 'C' standards: http://www.keil.com/product/isoansi.asp
"In some examples, in the main function, one function is getting called and after that, they are using while(1){}"
You mean something like this:
int main() { // do // some // stuff : : while(1) {} }
Yes this is perfectly normal for embedded systems: main() should not reutrn - where would it return to ... ?!
Typically, embedded systems just run "forever" - responding to events (interrupts) from the outside environment.
See, eg, electronics.stackexchange.com/.../what-happens-when-an-embedded-program-finishes
Again, I think you need to start here: www2.keil.com/.../learn
See also: http://www.keil.com/books/