Keil Logo

How to input a binary number?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Jack Lee
Posted
15-Sep-2012 11:14 GMT
Toolset
C51
New! How to input a binary number?

I'm using Keil to developing C8051 programs. In C51, we can type 0xff to input a hex number, so how to type a binary number? On the Internet someone said we can type for example 0b00010001 to express a binary number, but it seems does not work.
Thanks for your help!!

Read-Only
Author
Mike Kleshov
Posted
15-Sep-2012 11:36 GMT
Toolset
C51
New! RE: How to input a binary number?

There is a neat trick that uses octal notation to input binary numbers:

http://embeddedgurus.com/barr-code/2009/09/binary-literals-in-c/

Read-Only
Author
Jack Lee
Posted
15-Sep-2012 13:37 GMT
Toolset
C51
New! RE: How to input a binary number?

Greet Answer!Thanks so much!

Read-Only
Author
Andrew Neil
Posted
15-Sep-2012 12:29 GMT
Toolset
None
New! RE: How to input a binary number?

The 'C' programming language has no way to enter binary literals.
This is standard, ANSI 'C' - it has nothing specifically to do with Keil or C51.

As noted, you can play "clever tricks" with macros if you wish...

Second time this question has come up this week:

http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/p/212973/752363.aspx#752363

Read-Only
Author
Whata Malarkey
Posted
15-Sep-2012 21:37 GMT
Toolset
None
New! Dubious waste of time

Second time this question has come up this week:

Good to see someone has got enough spare time to keep check on every forum in the whole world to keep track of such statistics.

Read-Only
Author
helping uart
Posted
16-Sep-2012 07:38 GMT
Toolset
None
New! RE: Dubious waste of time


>>Second time this question has come up this week:

>>Good to see someone has got enough spare time to keep check on every forum in the whole world to keep track of such statistics.

Indeed !

Read-Only
Author
Whata Malarkey
Posted
16-Sep-2012 11:50 GMT
Toolset
None
New! RE: Dubious waste of time

Indeed !

LOL

Read-Only
Author
Andrew Neil
Posted
22-Sep-2012 12:54 GMT
Toolset
None
New! RE: keep check on every forum in the whole world

No - only about half a dozen forums.

Read-Only
Author
Whata Malarkey
Posted
22-Sep-2012 16:15 GMT
Toolset
None
New! What. Yet more statistics???

Ahhh. I see.

Read-Only
Author
Neil Kurzman
Posted
16-Sep-2012 04:53 GMT
Toolset
None
New! RE: How to input a binary number?

I though Binary was add to one of the newer ANSI revisions. No?

Read-Only
Author
Braindude amazing
Posted
16-Sep-2012 08:17 GMT
Toolset
None
New! RE: How to input a binary number?

Embedded image processing in ARM
Hello evryone...i know some image proc in matlab am planning to take a gaint leap to embedded image processing have to do a project...i knw nothing about ARM....am planning to implement hand gesture recognition in an ARM totally embedded...and i programthat in matlab and convert to C...then burn ut in arm....
i want to knw....If i am sane about what iam talking about...Does ARM have the processing power??? and what is the good palce to start learnngembeded image processing???please reply have to decide the project soon.... Please some suggestions...

Read-Only
Author
Erik Malund
Posted
16-Sep-2012 13:45 GMT
Toolset
None
New! maybe you are, but

If i am sane
maybe you are, but it is insane to attach something totally unrelated to a thread.

Erik

Read-Only
Author
Braindude amazing
Posted
16-Sep-2012 15:20 GMT
Toolset
None
New! RE: maybe you are, but

I am happy u knw y...coz atlast my ques s visible.,.i wd be hapier if u post d anser in d corespondin thread.,.. I hav bn waitin d whole day havnt anybdy stufd a img proc in an arm..??

Read-Only
Author
Neil Kurzman
Posted
18-Sep-2012 02:54 GMT
Toolset
None
New! RE: maybe you are, but

New Question?
Start a New Thread
http://www.keil.com/forum/post.asp

If you Post in SMS the image processing units on other forum users may return a gibberish error and log a do not reply to message fault. Give a little more Detail. Yes the ARM is a powerful CPU. But no match for a Multi-core PC with many gigs on RAM.

Read-Only
Author
Dan Henry
Posted
16-Sep-2012 16:08 GMT
Toolset
None
New! RE: newer ANSI revisions. No?

No. Neither C99 nor C11 added binary constants.

Read-Only
Author
Neil Kurzman
Posted
18-Sep-2012 02:55 GMT
Toolset
None
New! RE: newer ANSI revisions. No?

Still a compiler specific extension then. I thought they finally added it.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.