avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?


From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?
Date: Fri, 23 Sep 2005 03:49:11 +0200

On Thu, 2005-09-22 at 18:00 -0700, Derric Tubbs wrote:
> I believe the original poster said he was new to
> programming.  If so, just remember that each hex digit
> represents four binary bits/digits with decimal values
> of 0-15.  It won't take long at all to get where
> reading hex, both for decimal value and bit pattern,
> happens without thinking about it.

Yeah I am fairly new to C programming (only one year epxerience, on
Microchip PIC's...and that was 5 years ago !), but not to electronics
engineering, so I have long got the hang of Hex notation ;-)

> Is there some reason you can't specify your constant
> as hex?

It's not that I can't, it' just that in some cases, a binary notation is
natural, and a hex one doesn't make sense.

Typical example is when I want to define a few custom characters for a
text LCD module. if you use a binary notation, it actually gives you a
very convenient visual representation of each character, since one bit
represents a pixel, and one byte represents one row for one character.
So you can very easily define the characters, whereas if using a hex
notation, it's a nightmare to define the characters, and you can't check
them visually for correctness, and making corrections is awkward.
That's just an example.



On Thu, 2005-09-22 at 20:03 -0500, David Kelly wrote: 
> We may make a FreeBSD user out of you yet.

Not a ray of hope in the current state of things ;-) I happen to have
eventually found the perfect Linux distro for me, so they would have to
go seriously wrong for to consider the hassle of changing 'home' ;-) ...


> Joerg included a/the patch for binary constants in the FreeBSD Ports  
> version of avr-gcc, which he maintains.
> 
Oh, I wonder what we would become without Joerg. Thank you for the patch
Herr Joerg :-)


> If this long URL survives then it will download the patch. You are  a
> Linux user so you have lots of practice applying patches, right?  :-)
> 
> 
You said it, I am Linux "user", not developper !! ;o)
I did once try to apply a patch to some program, but I failed miserably,
both because I couldn't find anywhere on the web the exact command line
to use, all where suggesting different options, and also because the
source code I had didn't exactly match what the patch was expecting.
Tried to apply the patch by hand, but the patch and source code were so
different, I really didn't know what to do with the patch.
> 
I guess I will just take the easy route, and wait patiently for the
patch to make it into the next stable release of gcc-avr ;-)



--
Vince





reply via email to

[Prev in Thread] Current Thread [Next in Thread]