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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/08 21:52
Read: times


 
#157603 - All depending on needs
Responding to: ???'s previous message
Named constants are always preferable when the bits to write do represent named functions.

But there are more needs for binary numbers than writing data to an SFR.

If you are working with a bit patterns for a display, there would be no names to declare.

uint8_t charmap[] = {
    // '+'
    BITS_00000000,
    BITS_00011000,
    BITS_00011000,
    BITS_01111110,
    BITS_01111110,
    BITS_00011000,
    BITS_00011000,
    BITS_00000000,
    ...
};
or easier to read and edit a bitmap directly in the editor with a slightly modified set of defines:

#define ________ 0x00
#define _______A 0x01
#define ______A_ 0x02
#define ______AA 0x03
...

uint8_t charmap[] = {
    // '+'
    ________,
    ___AA___,
    ___AA___,
    _AAAAAA_,
    _AAAAAA_,
    ___AA___,
    ___AA___,
    ________,
    ...
};


Quite possible to edit the bitmaps




List of 10 messages in thread
TopicAuthorDate
Keil (Binary numbers)            01/01/70 00:00      
   Not possible            01/01/70 00:00      
   C does not allow it But...            01/01/70 00:00      
      Binary in C            01/01/70 00:00      
         Grouping works too            01/01/70 00:00      
            my way            01/01/70 00:00      
               All depending on needs            01/01/70 00:00      
         To be precise            01/01/70 00:00      
            It is not an omission            01/01/70 00:00      
   binconst.h            01/01/70 00:00      

Back to Subject List