STM32 HAL IAR Remaining in while(x);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-08 8:03 AM
Hello friends
i set x=0; in timer Interruption x=0; per 1ms
in my program i using this Code
x=1;
while(x);in debug i see x is 0 but CPU Remaining in while(x)
but if my while have any command work right and exit from while!!
x=1;
while(x); not exit if x == 0x=1;
while(x) {for example LCD_Clear();} // exit from this while if x == 0Is this a law in IAR or this is bug ?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-08 10:29 AM
Thank you very much
The problem was solved- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-08 8:09 AM
Possibly due to the compiler optimising the code. Is x declared volatile? It should be. If not, the compiler is free to assume that the value never changes, and will read it only once. Step through the assembler and see whether the variable is actually read on every iteration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-08 10:29 AM
Thank you very much
The problem was solved