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 enter an binary data in Keil?

How can we do this
In assembly we do
mov P0, #10001000B

But in Keil how can we do this
P0 = 10001000, in binary
not by
P0 = 0x11;
Thank you!

Parents
  • I've found a topic to do this

    #define LongToBin(n) \
    (\
    ((n >> 21) & 0x80) | \
    ((n >> 18) & 0x40) | \
    ((n >> 15) & 0x20) | \
    ((n >> 12) & 0x10) | \
    ((n >> 9) & 0x08) | \
    ((n >> 6) & 0x04) | \
    ((n >> 3) & 0x02) | \
    ((n ) & 0x01) \
    ) #define Bin(n) LongToBin(0x##n##l)

Reply
  • I've found a topic to do this

    #define LongToBin(n) \
    (\
    ((n >> 21) & 0x80) | \
    ((n >> 18) & 0x40) | \
    ((n >> 15) & 0x20) | \
    ((n >> 12) & 0x10) | \
    ((n >> 9) & 0x08) | \
    ((n >> 6) & 0x04) | \
    ((n >> 3) & 0x02) | \
    ((n ) & 0x01) \
    ) #define Bin(n) LongToBin(0x##n##l)

Children