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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/17/05 16:31
Read: times


 
#85110 - I think that...
Responding to: ???'s previous message
I think that what Mr. Botha was trying to ask about is if he could put the bit number for one of his three devices into a variable and then use that variable like an address source for the bit to the port pin.

Unfortunately this does not work as the 8052 instruction set does not support indirect bit addressing. Only direct bit addressing is allowed.

This issue has come up recently where somebody was hoping for an @R0 addressing mode to a bit with the bit number in the R0 register. However such instruction does not exist.

Leon's use of C language puts a slightly different light on the subject but the Keil C does not support an indirect BIT support mode either !!

Michael Karas

BTW.....If I get some time later today I'll write up a small subroutine that would give the equivalent behavior of an indirect bit function....but it uses a table and so takes more code space than a simple mask like Peter suggested or a If-ElseIf-ElseIf-ENdif structure to sort out which bit number to access.
MJK


List of 24 messages in thread
TopicAuthorDate
sbit            01/01/70 00:00      
   I do not understand            01/01/70 00:00      
      You mean Dallas 1-Wire?            01/01/70 00:00      
   Re            01/01/70 00:00      
   What's the problem?            01/01/70 00:00      
      I think that...            01/01/70 00:00      
         indirect bit addressing            01/01/70 00:00      
         The same iButton on all 3?            01/01/70 00:00      
         sbit            01/01/70 00:00      
            access all 3 , one at a time            01/01/70 00:00      
   I had the same problem            01/01/70 00:00      
      Lets try again            01/01/70 00:00      
         Need ?            01/01/70 00:00      
         Why?            01/01/70 00:00      
         There is always the switch statement            01/01/70 00:00      
            something like this...            01/01/70 00:00      
         Simultaneous example            01/01/70 00:00      
            Use MASK rather than bit address            01/01/70 00:00      
               Oooops, sorry...            01/01/70 00:00      
      Multiple 1Wire            01/01/70 00:00      
         How to post code, and possible hang-up            01/01/70 00:00      
         simultaneous?            01/01/70 00:00      
            would even be better            01/01/70 00:00      
               If it worked!            01/01/70 00:00      

Back to Subject List