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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/22/04 15:34
Read: times


 
#63136 - MDI
Responding to: ???'s previous message
...C program which I am going to cross compile to assembly.

Why?

...part of the I2c control register there is a bit called MDI,
is it correct to write:

if((MDI)&0x01) 
{ 
   //input bit 
} 
else 
{ 
   //input 0 
}

Well, if MDI really is a bit, what's the point in ANDing it with 0x01?

If the register is bit-addressable, and your compiler supports it, you can just use the bit directly;
If the register is not bit-addressable, you have to use the normal 'C' masking approach to isolate the specific bit from the byte.

If you have an 8051 compiler that doesn't support bit-addressing, you should get one that does!


List of 4 messages in thread
TopicAuthorDate
Sdata line            01/01/70 00:00      
   RE: Sdata line            01/01/70 00:00      
      RE: Sdata line            01/01/70 00:00      
   MDI            01/01/70 00:00      

Back to Subject List