MORE RELATED

GROOMIX INFO
Blogs & Articles
MENU
. . .

programming

views : 250

ATMEL STUDIO-While loop conditioning issues

Sometime while loop does not work as we want even if condition is fulfilled. Action there is a basic function of a while that we are ignoring while applying conditionings.

How while loop is actually works

Basic syntax 

While(c ondition ) {
Stateme nts . . . . 
*Condit ion changing . . . . 

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 :
Mr. Unique

2017-08-06/11:14:52

Share this Page

Comments...

More :programming

programming
Arduino UNO tachometer coding with variable resistor and DC motor speed control

p

programming
Here is the code to interface 2 serial devices with AVR

p

programming
Software Uart for AVR microcontroller tested on 1200 baud rate

p

programming
ATMEL STUDIO-While loop conditioning issues

p

programming
ATMEL STUDIO-While loop is not working using interrupt incremented conditioning

p

programming
Copy and paste code for facebook share button in your websites
programming
How to program atmel 8051 family microcontroller? (step by step)
programming
Embedded program code in C language for Digital Voltmeter for AVR microcontroller
programming
Assemby program code for Automatic Door Opening System (8051 family microcontroller)
programming
Very simple and accurate Seven Segment Display program Code in Embedded C language

p

programming
Highway vehicle speed detector or checker Embedded C language code in MikroC AVR Framework also applicable for 8051 Microcontroller

p

programming
Assembly program for accurate 1 second delay function
programming
What is Embedded system programming?

Latest Updates

programming
Arduino UNO tachometer coding with variable resistor and DC motor speed control
views :219

p

programming
Here is the code to interface 2 serial devices with AVR
views :175

p

programming
Software Uart for AVR microcontroller tested on 1200 baud rate
views :719

p

programming
ATMEL STUDIO-While loop conditioning issues
views :250

p

programming
ATMEL STUDIO-While loop is not working using interrupt incremented conditioning
views :306

p

programming
Copy and paste code for facebook share button in your websites
views :310
programming
How to program atmel 8051 family microcontroller? (step by step)
views :355
programming
Embedded program code in C language for Digital Voltmeter for AVR microcontroller
views :294
programming
Assemby program code for Automatic Door Opening System (8051 family microcontroller)
views :235
programming
Very simple and accurate Seven Segment Display program Code in Embedded C language
views :198

p

programming
Highway vehicle speed detector or checker Embedded C language code in MikroC AVR Framework also applicable for 8051 Microcontroller
views :168

p

programming
Assembly program for accurate 1 second delay function
views :179
programming
What is Embedded system programming?
views :220

---More To Do---

This pages is developed to give users a genuine web materials of all types throughout the world. Many articles, by experts are publishing here, every hours. You can publish your topics as well as you can comment on all posted topics and learn more. Many types of topics are published here like Technology based ( Electronics, Electricals, Mechanicals, civil engineering, computer science, programming and software development, Assemply language codings), Health like medicine, healthy diets, Homeopathy etc) and many types of latest news updates.


All content, design, and layout are Copyright © 2016 - Digital Photography Review All Rights Reserved. Reproduction in whole or part in any form or medium without specific written permission is prohibited.

MORE TO DO