View unanswered posts | View active topics It is currently Mon Jun 18, 2018 1:59 am

 Page 1 of 1 [ 9 posts ]
 Print view Previous topic | Next topic
Binary numbers on RobotC
Author Message
Expert

Joined: Sun Sep 09, 2007 10:12 am
Posts: 116
Binary numbers on RobotC
I will need to know if there is or is planned to exist something like:

000011010b

or even

0b000011010

what i mean is the possibility of store on a byte a binary value.

THanks

_________________
http://www.apcsguarda.com
My Project: http://www.robotc.net/forums/viewtopic.php?f=15&t=712

Thu Sep 04, 2008 3:17 pm
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616
Re: Binary numbers on RobotC
Currently ROBOTC recognizes decimal and hexadecimal constants. Hex constants are prefixed by the two characters "0x". For example, "0x20" is decimal 32.

With a little practice, it's pretty easy to convert between text numbers in binary and hexadecimal values.

ROBOTC does not currently support binary constants in "text strings".

Wed Sep 17, 2008 8:55 pm
Expert

Joined: Sun Sep 09, 2007 10:12 am
Posts: 116
Re: Binary numbers on RobotC
i know how to convert it, the problem sometimes is explain to kid's how to do it...

_________________
http://www.apcsguarda.com
My Project: http://www.robotc.net/forums/viewtopic.php?f=15&t=712

Thu Sep 18, 2008 4:02 am
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616
Re: Binary numbers on RobotC
 Quote:I know how to convert it, the problem sometimes is explain to kid's how to do it...

OK. I understand this point and it was a very simply change. So I just added "binary" numeric constants to the ROBOTC compiler. They're of similar format to hex constants, i.e. precede the constant with "0b" or "0B" as in "0b11101".

NOTE: The standard C language (or C++) does not support this definition. They would generate a syntax error. This is an extension unique to ROBOTC.

This will appear in the next release of ROBOTC.

Thu Sep 18, 2008 6:47 am

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Re: Binary numbers on RobotC
Dick,

WinAVR has it, too See http://winavr.scienceprog.com/short-int ... guage.html for more info. I would love to see this notation and I am glad you've decided to implement them!

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]

Thu Sep 18, 2008 7:21 am
Expert

Joined: Sun Sep 09, 2007 10:12 am
Posts: 116
Re: Binary numbers on RobotC
 Dick Swan wrote:This will appear in the next release of ROBOTC.

There are things like this that keep me loving and using RobotC. A good forum, with excelent people and a excelent crew.

Thanks all

_________________
http://www.apcsguarda.com
My Project: http://www.robotc.net/forums/viewtopic.php?f=15&t=712

Thu Sep 18, 2008 11:49 am
Guru

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Re: Binary numbers on RobotC
 docilio wrote: A good forum, with excelent people and a excelent crew. Tanks all

You're welcome!

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)

Thu Sep 18, 2008 1:19 pm
Moderator

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Re: Binary numbers on RobotC
ohh boy binary math!

B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/

Sun Sep 21, 2008 5:33 pm
Rookie

Joined: Tue Mar 01, 2016 11:33 am
Posts: 1
Re: Binary numbers on RobotC
Well I use any online tool for binary conversion, among all I prefer rapid tables converter when I need to know the method as well as it do tell the calculations also, this tool is nice and I got to know about this recently. I would like to give some credit to that source, I found this tool here on this post on focusandleap.

Thank You

Tue Mar 01, 2016 11:36 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 9 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning