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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/09/03 23:19
Read: times


 
#45138 - RE: Port status and bit status
Responding to: ???'s previous message
No.

MOV A,P1
All bits on port 1 are copied to the accu.

LOOP: CJNE A,#01H,LOOP
If the contents of the accu is not 1, check the accu again. Since the accu does not change by itself, you will probably end up in an infinite loop.

A CPU is not human. It does not do what you would want it to do, and it does not remember its last step.

What you want to do would code as:

loop: cjne p1,#0,loop

although i would call it bad practice to voluntarily lock yourself up in a loop which excludes any other sort of activity.

To find out which bit on port 1 was responsible for it not being 0 will require further steps.
Also, learn to think in "negative logic". That is: 1 is off, 0 is on. This corresponds much better with how at least the 8051's ports are constructed.


List of 33 messages in thread
TopicAuthorDate
Port status and bit status            01/01/70 00:00      
   RE: Port status and bit status            01/01/70 00:00      
      RE: Port status and bit status            01/01/70 00:00      
   RE: Port status and bit status            01/01/70 00:00      
      is it possible to write like this            01/01/70 00:00      
         RE: is it possible to write like this            01/01/70 00:00      
         RE: is it possible to write like this            01/01/70 00:00      
            RE: is it possible to write like this            01/01/70 00:00      
         RE: is it possible to write like this            01/01/70 00:00      
         RE: is it possible to write like this            01/01/70 00:00      
            My Approach            01/01/70 00:00      
               RE: My Approach            01/01/70 00:00      
               RE: My Approach            01/01/70 00:00      
               RE: My Approach            01/01/70 00:00      
                  use of interputs for polling            01/01/70 00:00      
                     RE: use of interputs for polling            01/01/70 00:00      
                        RE: use of interputs for polling            01/01/70 00:00      
                           RE: project            01/01/70 00:00      
                              RE: project            01/01/70 00:00      
                                 RE: project            01/01/70 00:00      
                           RE: project            01/01/70 00:00      
                              RE: project            01/01/70 00:00      
                                 how come this happens            01/01/70 00:00      
                                    RE: how come this happens            01/01/70 00:00      
                                       RE: how come this happens            01/01/70 00:00      
                                    RE: Its you Waqar as Lance Austin            01/01/70 00:00      
                                       RE: Its you Waqar as Lance Austin            01/01/70 00:00      
                                       RE: Its you Waqar as Lance Austin            01/01/70 00:00      
                                          RE: Its you Waqar as Lance Austin            01/01/70 00:00      
                                    RE: someone Help            01/01/70 00:00      
                                       RE: someone Help            01/01/70 00:00      
   Thankyou            01/01/70 00:00      
      RE: Thankyou            01/01/70 00:00      

Back to Subject List