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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/01/03 18:02
Read: times


 
#47183 - RE: Grabbing a bit from a byte?
Responding to: ???'s previous message


the following below was produced by the RC51 COMPILER from the source you provided.

mychar = 0xFF;
mymask = 0x02; //I want to get bit 1
mybit = mychar & mymask;

converts to..

ASSEMBLY LISTING OF GENERATED OBJECT CODE

            ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 20 
0000 7500FF  R      MOV    mychar,#0FFH
                                           ; SOURCE LINE # 21 
0003 750002  R      MOV    mymask,#002H
                                           ; SOURCE LINE # 22 
0006 E500    R      MOV    A,mymask
0008 5500    R      ANL    A,mychar
000A 24FF           ADD    A,#0FFH
000C 9200    R      MOV    mybit,C



Is this not tight enough..

List of 10 messages in thread
TopicAuthorDate
Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
      RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      

Back to Subject List