This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do I get the bit address in Keil C

Hi,

I want to know the address of a bit variable.
For example:

bit gBit;
func()
{
  printf("%d", &gBit);
}
How do I know where the variable gBit is allocated by the linker in run time?

Parents
  • So it also records all the addresses of bit variables that need to initialized before the main function is called. By using this address of the bit variable, it can give the bit variable initial value.

    The initialization code converts the bit address into a byte.bit address and then uses and and or to mask and set the bit accordingly.

    There is no instruction on the 8051 that supports indirect access to bits. It has to be done manually.

    Jon

Reply
  • So it also records all the addresses of bit variables that need to initialized before the main function is called. By using this address of the bit variable, it can give the bit variable initial value.

    The initialization code converts the bit address into a byte.bit address and then uses and and or to mask and set the bit accordingly.

    There is no instruction on the 8051 that supports indirect access to bits. It has to be done manually.

    Jon

Children