Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] STM32 HAL IAR Remaining in while(x);

Status
Not open for further replies.

azadfalah

Full Member level 2
Full Member level 2
Joined
Aug 13, 2016
Messages
145
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,423
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 == 0

x=1;
while(x) {for example LCD_Clear();} // exit from this while if x == 0

Is this a law in IAR or this is bug ?

- - - Updated - - -
Answer

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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top