View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 04, 2012 2:51 pm |
|
|
Quote: | int8 j[8] = {10001000,01110001,01010001,01100001,01111001,01110101,01110011,01110000};
|
What's the correct way to specify a number in binary format in C ? |
|
|
spark
Joined: 03 Jan 2012 Posts: 17
|
|
Posted: Wed Jan 04, 2012 3:11 pm |
|
|
Thanks for pointing it out. I had a look at the reference Manual (around page 40), but I still don't know it. Do I need to use const? Sorry for that, but I have no idea. Please tell me.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 04, 2012 3:51 pm |
|
|
No, you don't need to use 'const'. Without it, the array will be placed in
RAM, which is perfectly OK.
It just occurred to me that you mean you don't how to specify binary
format. Just put '0b' in front of each of the numbers in your array.
(Without the single quotes). |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Jan 04, 2012 4:13 pm |
|
|
d'jou look at your LST file to see what this signed int8 compiles to??
Code: |
int8 j[8] = {10001000,01110001,01010001,01100001,01111001,01110101,01110011,01110000};
|
IMHO - VERY odd notation you use there - so
after you read the .LST -- -is it REALLY what you were after??? [/b] |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jan 04, 2012 4:18 pm |
|
|
It is all shown in the CCS manual. It gives the prefix to use:
Quote: |
Expressions
Constants:
123 Decimal
0123 Octal
0x123 Hex
0b010010 Binary
|
Enough on bonehead programming. We don't need a huge thread on
basic bonehead stuff. |
|
|
spark
Joined: 03 Jan 2012 Posts: 17
|
|
Posted: Wed Jan 04, 2012 4:35 pm |
|
|
Thanks. It's working now. |
|
|
|