Keil Logo

General queries

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
ramakrishna rachumallu
Posted
13-Feb-2019 06:08 GMT
Toolset
None
New! General queries

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?

Author
Andrew Neil
Posted
13-Feb-2019 10:26 GMT
Toolset
None
New! RE: General queries

"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, http://electronics.stackexchange.com/questions/30830/what-happens-when-an-embedded-program-finishes

Again, I think you need to start here: http://www2.keil.com/mdk5/learn

See also: http://www.keil.com/books/

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.