Post by Derric TubbsI 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 ;-)
Post by Derric TubbsIs 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.
Post by Derric TubbsWe 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' ;-) ...
Post by Derric TubbsJoerg 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 :-)
Post by Derric TubbsIf 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