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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/09/04 10:33
Read: times


 
#82814 - Outputting and Inputting Bits
Responding to: ???'s previous message
Jason:

You mentioned that the SETB, CLR, and CPL bit instructions are availanle for sending bits out of the 8051.

This is true. Now if you want to read and respond to bits you get in from the 8051 port....then there are multiple ways to get the job done. Here are a few ideas:

  1. Read the port as a byte into the A register and then perform an AND of the A register with a bit mask to isolate a particular bit and use the JZ / JNZ instructions to branch based upon the bit value.

  2. Address the port the bit directly, such as P1.0, and use the JB / JNB instrictions to branch based upon the bit value.

  3. Move the bit to the CY flag using the MOV bit instruction and then use the JC / JNC instructions to branch based upon the bit value.


Michael Karas


List of 14 messages in thread
TopicAuthorDate
DPTR for internal code            01/01/70 00:00      
   DPTR.......            01/01/70 00:00      
   Look at Instructions set            01/01/70 00:00      
   DPTR for code memory            01/01/70 00:00      
      Port scanning            01/01/70 00:00      
      DPTR and I/O Ports            01/01/70 00:00      
      Outputting and Inputting Bits            01/01/70 00:00      
         Jump Table?            01/01/70 00:00      
   It can Not            01/01/70 00:00      
   DPTR for code memory            01/01/70 00:00      
      Do the independent bit tests            01/01/70 00:00      
         very complex bit testing            01/01/70 00:00      
      Dptr for code memory            01/01/70 00:00      
   JB            01/01/70 00:00      

Back to Subject List