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 to implement a BOOLEAN ARRAY on C51?

I think the implement will use SFR-BIT. Help me.

Parents
  • You didn't say which toolset; I'm assuming C51:

    NO - you can't have arrays of bits (see "Bit Types" in the manual)

    You can, however, have an object in which individual bits can be accessed directly - see "Bit-Addressable Objects" in the manual - although this does not give you indexed access to the bits.

    Review this thread, which includes submissions with example code:
    http://www.8052.com/forum/read.phtml?id=20996

    But, if you don't specifically need an array of bits, just do what conventional 'C' compilers do - an array of bytes, in which each byte value is considered to represent either false (value==0) or true (value!=0)

Reply
  • You didn't say which toolset; I'm assuming C51:

    NO - you can't have arrays of bits (see "Bit Types" in the manual)

    You can, however, have an object in which individual bits can be accessed directly - see "Bit-Addressable Objects" in the manual - although this does not give you indexed access to the bits.

    Review this thread, which includes submissions with example code:
    http://www.8052.com/forum/read.phtml?id=20996

    But, if you don't specifically need an array of bits, just do what conventional 'C' compilers do - an array of bytes, in which each byte value is considered to represent either false (value==0) or true (value!=0)

Children