Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/22/01 06:36
Read: times


 
#14321 - RE: use of flag
Hi Irfan,

Its simple:

In our real life we take decisions subject to various IFs and conditions.

1. A train approaching the railway station, if driver finds signal down (if flag = 0) then he enters the station otherwise if he finds signal up (flag = 1) he stops and waits until flag = 0.

2. A drug smugler approaches a cross road and finds a police car (flag = 0) he does not pass on the stuff to the other party and waits until the cops are gone (flag = 1).

3. I will no more work free (flag = 1) for people until I get in advance (flag = 0)........


So, you see likewise we can make powerful use of flag bits to control the flow of our code and to make certain decisions.

As it looks like from your question, you think they are a must:

Flags are not a "MUST" to use in code. They are used only when required, and only the code developer knows whether or not he should use a flag in a particular situation.

How to make flags in the code:

You know there is a lower part of the RAM in the micro which is bit addressable, means you can touch the bits individually.

You define the bits in the beginning of code,

My_Flag bit 30h

(you can use flag bits even without defining but that makes code legibility too poor)

You can use this flag named "My_Flag" in the code.

Hope this helps

Babar



List of 17 messages in thread
TopicAuthorDate
use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag, Babar            01/01/70 00:00      
RE: use of flag, Babar            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      

Back to Subject List