Basic syntax
Somet imes , when we use while loop where conditioning variable is changing somewhere else like in "interrupt subroutine". But what happens there in subroutine we restore "program status register" after changing conditioning variable.
But, "while loop" check condition only when there is any changes in "program status register"
(I noticed this in ATMEL STUDIO, AVR microcontroller )
There is three options to resolve this problem :
1. Inside while loop, Change "program status register " (you can change even a single bit like SREG ^=(1<<SREG_C) ie. Carry bit )
2. In while loop, any statement that alter SREG register value .
3. Or you can stop restoring SREG in "interrupt subroutine "
Posted By :
Mahesh Nigam
(Scientist)
2019-09-27 17:13
See Author's other Published Topics
Peoples
Peoples
Comments...
Write Your Comment