We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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!
http://www.c-for-dummies.com/
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)
By The Way: Note that Keil C51 does provide an extension to the standard 'C' language that allows you to make use of the 8051's bit-addressable features.
You need to look it up in the Manual
This won't help you for writing binary constants, of course.
It works right!